Code Samples, Tips, Tricks and
other Neat Stuff for the VB developer

All Content Copyright © 2000
New Vision Software
All rights reserved

VB Petition

Many of you may not be aware that Microsoft's mainstream support for VB6 officially ended on March 31st, 2005.  Now that this has occurred, it becomes increasingly more likely that future updates to Windows may break existing VB code.  If you are concerned about this and/or are concerned about migration issues associated with bringing existing VB code to the .NET platform, please take a moment to read and sign the petition asking Microsoft to extend there COM based VB product line.  The impetus behind the petition is the desire to give companies and individuals with substantial investments in existing VB code a path forward to the latest development platform without the current requirement for wholesale rewrites of existing code.  Thanks for your support!

Bryan

   

Home

All Sample Projects

Grouped Samples

Common Dialogs

Control Stuff

Date & Timezone

Drawing

Graphics

Text

File Routines

Form Modifications

Icon Routines

Listbox & ComboBox

Menus

Mouse

Subclassing

Text Parsing Routines

UserControl Demos

Specific Samples

Activate Previous

Instance

API & OLE DragDrop

Environment Variables

GUID - UUID

ListView

Message Box

Collections

Thunking

File Split Utility

Save Clipboard Utility

Visual Basic Tips!


 

Visual Basic Tips!

This section contains useful tips that may help you with your VB project development.

 

LockWindowUpdate  MS does not recommend the use of the LockWindowUpdate API function for preventing drawing to a specific window while multiple updates are occurring.  The preferred method is to use the the SendMessage API function along with the WM_SETREDRAW constant passing the hWnd of the specific window that should not be redrawn.

The VB End statement  The VB End statement should not be used because it doesn't allow any "clean up" code to run in your application.  The correct method for ending an application is to unload all forms, disabling any active timer controls before unloading the parent form as well as setting any references to forms or classes equal to the VB keyword Nothing.  Once all object references are destroyed, your application should end on it's own.

NOT +  For String Concatenation  In past versions of Basic, the addition operator (+) did double duity as the string concatenation operator.  Visual Basic now has the string concatenation operator (&) which should be used for this purpose.  This is especially evident when you attempt to concatenate strings containing numbers.  You may find that instead of a longer string you actually get the sum of the two substrings.

The IDE "Stop" Button  Use of the stop button should be avoided at all costs.  Using the stop button is the same as executing the End statement in your project code and will not allow any clean up code to run.  This is especially true when you are using subclassing in your project since stopping execution does not restore the original window proc address in the class structure of the subclassed window.  The only acceptable use of the stop button is for stopping an activeX exe since this is the only method supplied for that purpose.

 

There isn't much here yet but check back, as the list is sure to grow as I have more time to add to it.