
Since 1998, DevX has helped people start businesses, build websites, and provide enterprise technology to people globally. Interviewing the likes of Microsoft’s co-founder, Steve Ballmer, the publication brings comprehensive, reliable, and accessible insights to the Internet.
To change the item’s location by dragging the mouse in a listbox, follow this tip: Sub List1_MouseDown (Button As _ Integer, Shift As Integer, X As _ Single, Y As
While the TreeView control with its associated Node objects isa far cry better than the VB3 Outline control, it lacks a methodfor sequentially traversing the tree, as if you were
A program originally written using the Borland C++ Compiler hastwo problems in Visual Basic 3.0, Standard Edition. This programuses trigonometry to calculate the distance between two points,when you know their
To highlight the row containing the active cell in a bound DBGrid,add the record set’s current bookmark to the grid’s SelBookmarkscollection: Private Sub DBGrid_RowColChange _ (LastRow As Variant, ByVal LastCol
The 32-bit API is much richer than the 16-bit API. However, theGetDriveType still reports networked CD drives as just a DRIVE_REMOTE(i.e., a networked drive). While true, it is not particularlyhelpful.
One of the trickier parts of handling date values is dealing withleap years. Everyone knows that every fourth year is a leap yearin which February has 29 days instead of
To prevent users from launching multiple instances of your application,check the PrevInstance property of VB’s App object; if the propertyis True, the program is already running. To activate the previousinstance,
In VB4 if you want to show a popup menu for a text box, a system-providedcontext menu appears first, and your popup menu does not appearuntil you close the system
A severe bug in VB4 appears when using the Databound Grid withmodal forms. Create 3 forms: form1, form2 and form3. Put a buttoncommand1 on each of the forms. In the
In VB4, each control array is its own collection and thereforehas a Count property. This was not the case in version 3. It isnow possible to loop through all of
When a procedure can operate on multiple types of controls, youcan use VB’s TypeOf function to determine a control type at runtime: Function myFunc(ctl as Control) ‘ This code works
Properly designed Windows programs should change their own colorsaccording to the system colors. One of the reasons why developerstend to forget that part of design is that it is not
Jet 3.0 includes an undocumented feature that lets you log Jet’soptimization plan of queries. To enable this feature, you mustcreate this registry key using Windows’ RegEdit program: HKEY_LOCAL_MACHINESOFTWAREMicrosoft _ Jet3.0EnginesDebug
This need was established by developing VB applications for 3270mainframe apps. A user typing in a 3270 edit field is automaticallyplaced into the next field once reaching the maximum number
When you write an If statement such as: If Category = “CM” or Category = “M2” or Category = “P1” or Category = “ZZ” thenProcessEmployeeEndif it can be simplified by:
If you have to assign True or False to a variable after testinga certain condition, then the If statement may be done away withaltogether. For example, if you have something
Most collections are zero-based. The COUNT property returns thenumber of members of a collection, as opposed to the highest membernumber. So when we see code that loops through all the
It’s a good idea to set your form variables to Nothing to recoverall memory that was allocated for the form module. Executing SetForm1 = Nothing for a loaded form, however,
This sample file from Microsoft allows a more automated Windows95 Registry Addition. You can create a similar file in Notepador your favorite text editor, replacing the appropriate entriesin place of
If you set a form properties caption to “” and controlbox to False, then a form with borderstyle 3 (fixed dialog) willdisplay without its title. Unlike borderstyle zero (none), itkeeps
In VB3, if you wanted to display a list box adjacent to anothercontrol such as a PictureBox on a sizable form, you were confrontedwith the problem that a list box’s
To secure a Jet database, you must purchase Access 2 for VB3/VB3-16or Access 95 for VB4-32 and follow these steps: Use the Access Workgroup Administrator to create a new workgroupwith
The regular grid that comes with Visual Basic cannot be editeddirectly. However, this problem can be easily circumvented withone line of code: Private Sub Grid1_KeyPress(KeyAscii As _ Integer)Grid1.Text = Grid1.Text
The Microsoft Masked Edit control only allows input that matchesthe mask. Similarly, you can only set the Text property to a stringthat matches the mask. If you have a mask
Do you want to facilitate the user to enter only uppercase charactersduring editing in text boxes and other edit controls? Irrespectiveof the position of CAPS LOCK key, this code in
You can add ‘Type Ahead’ functionality to the standard VB ComboBoxcontrol with this subroutine: Sub ComboTypeAhead(Combo As ComboBox)Dim i As Integer, _ KeyString As String, _ KeyLen As IntegerKeyString =3D
In order for a label to be associated with a control (such as a textbox) for using hot keys, they must be in TabOrder sequence, the label beingone more than
If the layout of VB4’s DBGrid is not changed at design time, it willautomatically configure to a new record set when the Data control is refreshedwith a new RecordSource.
Shut down the instance of Visual Basic that uses the compiled in-processOLE server to unload the server from memory. Changes to the in-processOLE server will not be seen until the
When using DDE Links at design time, the link will be temporarily cutwhen the program is run. Some, but not all, programs will reestablish theconnection.