Visual Basic

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search

Navigation

computing: software: programming: Visual Basic

Overview

Microsoft Visual Basic, often abbreviated "VB", is a computer language and IDE. The latest version is VB6, which seems to be no longer (or minimally) supported; VB6's successor, VB.NET, is apparently a rather different language and not entirely backward-compatible.

Features

  • of the Language
    • Event-driven
    • Supports object-oriented programming (although it is essentially method-based, and also does not support inheritance)
    • Unlike older BASIC varieties, does not require line numbers; can use text as labels just as easily
    • Supports required definitions, i.e. the compiler will give an error if you use an undefined variable
    • Supports variant-type variables which can store any data type
  • of the IDE
    • Function fill-in popups which show:
      • all arguments needed by a function, subroutine, or method
      • which argument you are currently filling in, based on cursor position
      • Listing of available fields/methods: on typing the name of an object plus ".", a list of defined fields and methods will pop up

Pros

Good for writing business applications where correct implementation of somewhat complicated logic is more important than speed or elegance of design.

Cons

Many programmers consider using VB for development to be sort of like eating candy for dinner, for reasons that I can't think of at the moment. It does tend to allow a lot of a programmer's mental muscles to atrophy through inactivity, however.

VB is only available for Windows, so cannot be used for cross-platform development.

VB only produces GUI-based applications, and cannot be used to write text console (i.e. DOS mode) applications.

Problems

listed more or less as they come up

Place a treeview control on page 1 of an SSTab. Set page 2 as the default. If you want to resize the SSTab to fill the form and resize the treeview to fill the tab, you run into problems because the treeview's location (mainly the "Left" field) isn't set properly until page 1 is displayed, and there doesn't seem to be any systematic way of determining when its location data is correct. The treeview's "visible" property is set True even though it isn't actually visible. (Perhaps the SSTab is setting the Left field to a weird value in order to hide the treeview?)

Notes

  • To convert an integer to a hexadecimal string, you don't look in any of the obvious places (e.g. the Format function); there is a special function called Hex.
  • To convert a hexadecimal string back to an integer, use the Val function: Val("&H" & strHex) where strHex is a variable containing the hexadecimal string to convert.

ActiveX

The following applies for properties of classes in "ActiveX EXE" projects, and may be slightly different for "ActiveX DLL" projects:

  • Private means the class is only available within the project, and not externally via the ActiveX interface
  • PublicNotCreatable
  • SingleUse
  • GlobalSingleUse makes all of the class's methods global methods of the project, rather than making the class itself exist as a global
    • Common practice: declare a "catch-all" object which creates and initializes the various classes you want on request, and make that object GlobalSingleUse
  • MultiUse means that the calling program may create objects of this class
  • GlobalMultiUse

Related Pages

Links

Reference

Tools

Non-Technical