September 25, 1999

Append a string to a textbox quickly and without flickering

The usual way to append text to a TextBox or a RichTextBox control is to concatenate the current contents with the new string: Text1.Text = Text1.Text & newString Here is a different approach, which is slightly faster and causes less flickering: Text1.SelStart = Len(Text1.Text)Text1.SelText = newString

Open the list portion of a ComboBox control

To programmatically open and close the list portion of a ComboBox control, all you need is sending the CB_SHOWDROPDOWN message to the control. Here is a routine that encapsulate the SendMessage API function: Private Declare Function SendMessage Lib “user32” Alias “SendMessageA” (ByVal _ hwnd As Long, ByVal wMsg As Long,

Check whether a form is loaded

You can load several instances of the same form, but VB doesn’t let you determine how many forms of a given class are currently loaded. You can work around this flaw by iterating over the Forms collection: ‘ Return the number of instances of a form’ that are currently loadedFunction

Don’t stop timers when a MsgBox is active

Not all developers know that Timer controls in compiled VB5 and VB6 applications aren’t stopped by MsgBox statement, so the Timer’s Timer event procedure is regularly executed even when the message box is being displayed on the screen.However, inside interpreted applications under all VB versions, Timers are stopped when a