Uses for Visual BAsic?

Thread Starter

beenthere

Joined Apr 20, 2004
15,819
We have had several posters ask about doing things with VB. There have been no replies, so I am curious about the usefulness of VB. I looked into VB3 years ago and gave it up as essentially unsuited to anything significant.

The posters have asked about using VB for various communication functions. Is it the case that VB can't be used for something as trivial as serial communications or reading in a joystick?
 

jut

Joined Aug 25, 2007
224
Is it the case that VB can't be used for something as trivial as serial communications or reading in a joystick?
No. VB is capable of reading and writing to the serial port. I once wrote a VB program that communicated to a PIC via RS232 to control I/O and read an A/D value.

Visual basic is one of the more easier languages to learn.... you have to learn the GUI as well (not that hard at all)... it's not simply text editing. For example, to get your program to use serial communication, you drag and drop a serial comm. object onto your form. The language itself is one of the easiest -- it's based off BASIC. VB also has a really cool feature -- it auto completes lines of code.

BTW, I was referring to VB 6.
 

thingmaker3

Joined May 16, 2005
5,083
I have a friend who uses VB a great deal. He makes a lot of .exe programs with it. He claims it saves him time in the long run. I'm not a software guy, so I don't use it.
 

bloguetronica

Joined Apr 27, 2007
1,541
My best use of VB is the trash bin. Yuck!:D

Its easy to make programs with VB, in a point and click fashion, but VB is an unstructured programming language (allows goto's and therefore sparguetti code). The other thing is that VB is from Microsoft, so it is a proprietary language. These two factors are more than enought to keep away from that language.
 

lightingman

Joined Apr 19, 2007
374
Hi all,O.K... I have writen many programs using VB.... Our heating system at the Theatre is controled by a PC using a program that I wrote with it, along with lighting controlers and the programmer for my car computer and a program that monitors the Theatres mains supply and power usage..Good old VB !!!!......Daniel.
 

Dave

Joined Nov 17, 2003
6,969
It is widely used in programming macros, as someone who uses Microsoft Office applications will tell you. Exactly how useful VB is in these cases I'm not sure.

From my personal experience, as someone who regularly uses Ansoft's EDA softwares (at the moment I spend around 30 hours a week at an Ansoft console), the macro development for Ansoft's softwares uses the VBScript language - yes that is the same VBScript that was used for the ILoveYou virus! Firstly, VBScript is basically an abridged version of the proper VB language with some specific features, as a result it is largely restricted compared to other VB languages. Secondly, it is simple and creating powerful macros is quick and effective.

I do recall when I worked for Philips that a colleague designed a complete VBA written MOSFET development tool used for discussing specifications and costings with customers, all powered from an Excel spreadsheet. Quite an achievement. I recall he got all the plaudits but I did all the parasitic parameter extraction of the MOSFET devices - incidentally using Ansoft Q3D Extractor and VBScript macros!!

Dave
 
C/C++ also allow 'goto', which should not be frowned upon in all circumstances. In some situations, 'goto' can provide elegant exit/cleanup paths and cleaner code (for example, in nested 'for' loops). The trouble is that some people use it to write bad code. And I'm not a fan of exceptions (as in C++)

IMHO, using VB for electronics/automation purposes is plainly wrong. Such programs resemble OS kernels in the way the code accesses resources. VB simply doesn't provide all that is needed for such code to be written (e.g. pointers).

Oh, you like point-and-click? Then use toolkits like Qt, wxWidgets and such. They accomplish two things: they have point-and-click window designers and they allow you to write C++ code. An added bonus (an important one) is portability. Even if the hardware access code proves itself non-portable, most of the code won't need to be modified, given the design is modular enough.

There are more things that speak against VB, no matter what you use it for. It resembles an interpreted language, but it doesn't have its advantages at all.

As for using it to interact with Excel and Access, my advice is to get a real database or storage backend (heck, even a flat file format looks like a better option).
 

Dave

Joined Nov 17, 2003
6,969
IMHO, using VB for electronics/automation purposes is plainly wrong. Such programs resemble OS kernels in the way the code accesses resources. VB simply doesn't provide all that is needed for such code to be written (e.g. pointers).
Although fundamentally different in its uses and implementation, Matlab does not provide pointers, however one can argue that it is one of the pre-eminent programming languages in engineering and science, including electronics and automation.

Dave
 

Dave

Joined Nov 17, 2003
6,969
As for using it to interact with Excel and Access, my advice is to get a real database or storage backend (heck, even a flat file format looks like a better option).
I would agree, however at the time we needed a quick, simple and portable way of gaining this capability - using VBA and Excel was the most straight forward approach. The main objective of the project was acquisition of reliable data and structuring this in an accessible way.

This was 2 years ago, so Philips may have gone for a more dedicated approach since then - I don't know.

Dave
 

m4yh3m

Joined Apr 28, 2004
186
I would like to chime in and say all programming languages are useful to those who can utilize it... this kind of thing reminds me of back when my father worked for IBM (formerly AT&T - they sold the complex + data to IBM). He wrote out quite elegant programs using REXX. Most of it was frowned upon because nobody else knew how to program in REXX. However, the applications he wrote made everybody's job easier, and they were always wanting more out of it. I'll never forgot the feelings/thoughts of "how stupid is everybody else" for bitching about a programming language that is STANDARD for the OS. He's not installing something brand new that has to slowly be integrated -- it's defacto IBM stuff. You use VMS you get REXX with it as well. People will always put down and bitch about that which they do not understand. He took the time to understand the language and made it work for him and others.

Obviously VB is a KISS-style language so that even the most in-experienced programmer can churn out some useful programs for their own use without having to worry about allocating chunks of memory and fidgeting with pointers. That doesn't make it useless. Bitching about programming languages is about as useless as bitching about OSes.

Oh, and screw AT&T. Screwed over his retirement twice. He's driving a school bus for the county now. DIAF, AT&T.
 

GS3

Joined Sep 21, 2007
408
Many years ago I used to program in the original basic
Rich (BB code):
10 input X
20 Y = peek 16524
30 poke 16526, X
40 Y = Y * X
50 print Y
60 goto 10
but now I cannot find anything as simple with which I can do similar things. I wish I could play around as easily. VB is more complex but also does not support input/output as easily. I am interested in interfacing the computer with the outside world so I can acquire data and log or process it and output control signals. I never got around to learning PICs etc so I remain frustrated.
 

jpitz31

Joined Oct 24, 2007
39
Just because a language supports goto and label statements does not make language unstructured. Also just because does not support pointers does not make the language any less of a language.

Just look a Java and C#. The current trend in application development these days is managed code. It allows the programmer to produce more robust code (without the problems of memory leaks due to poor implementation of pointers)

With Visual Basic as with any structured language it it up to the programmer just how structured he or she wants to make it.

For example you can turn on a directive called Option Explicit in Visual Basic that forces variable declaration.

Visual Basic 6.0 was a great easy to use language that allows quick code development whether you were writing console applications or full blown GUI (windows) applications.

Visual Basic also allows users to make external calls to functions that reside in a DLL. This type of support allows programmers to make use of Windows low level operating system code.

Visual Basic .net is now object oriented falls under the same managed code as other .net languages:

Here is a quote from Microsoft:

"In fact, at runtime, the CLR has no idea which programming language the developer used for the source code. This
means that you should choose whatever programming language allows you to express your intentions most easily. You
may develop your code in any programming language you desire as long as the compiler you use to compile your code
targets the CLR."

This provides a great degree of flexibility for the programmer.

Would you use Visual Basic to program your micro-controller? Probably not. But you could very effectively write a PC based interface to your micro-controller to provide device automation control of your micro-controller.

Here is an example of a Visual Basic application that reads and writes to the serial port that monitors and controls a micro-controller.

http://www.instructables.com/id/Control-real-world-devices-with-your-PC/?ALLSTEPS

Thanks

Joe
 

Tahmid

Joined Jul 2, 2008
343
My best use of VB is the trash bin. Yuck!:D

Its easy to make programs with VB, in a point and click fashion, but VB is an unstructured programming language (allows goto's and therefore sparguetti code). The other thing is that VB is from Microsoft, so it is a proprietary language. These two factors are more than enought to keep away from that language.

Hi,

You should have a look at VB2008. I use it and it is very powerful. Plus, if you can write your programs efficiently, VB is a very good language in the sense that it is very easy to learn yet powerful.
 
Top