Code Samples, Tips, Tricks and |
All Content Copyright © 2000 New Vision Software All rights reserved |
| |
Instance |
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. |