Comments on the use of Visual Basic

Top  Previous  Next

VB is a very easy language to learn, and makes it very easy to interface to a Windows display (when you change a variable, the display on the screen is updated automatically). VisualBasic offers lots of short cuts (you don't have to declare variables as certain types, etc.) - which I advise you not to use: data type safety (making sure the values correspond to the right 'kind of thing') helps you avoid lots of errors.


VB has a lovely function called DoEvents, which enables the program to wait for a certain time, but to have other events being processed at the same time (using re-entrant functions). This completely removes the need for a great many timer events. There's an example in the example task; while one part of the program is waiting for the pellet dispenser, the same program can also respond to lever-presses. You do have to be a little careful with re-entrant functions (in particular, not to fiddle with global variables in certain ways, and not to allow too many re-entrant calls; these issues are discussed in the VB on-line manual).


With the SDK Control, most of the potential problems with VB as a language are removed (the language has no native support for TCP/IP sockets, and the socket Control that is packaged with VB is hopeless). I hope that the SDK makes VB programming simple - it is the language that most users of WhiskerControl will probably use!


If you have any comments or suggestions on improving the SDK for VB programming, please contact the author.