| |
|
Home | Links ( Motorcycles, Computers ) |
Declare all variables to save programming time by reducing the number of bugs caused by typos (for example, aUserNameTmp vs. sUserNameTmp vs. sUserNameTemp).
In Visual Basic 6, go to Tools > Options > Editor tab, then turn on "Require Variable Declaration." This should add "Option Explicit" to the General Declarations section of any new modules or forms you create. You can also manually type in "Option Explicit" , without the quotes, at the top of the code for each form/module that has already been created.
Would you like to avoid having to modify the path in your Visual Basic program, every time you need to run it from a different subdirectory or drive?
Use these steps to make your life easier:
- Add the following commands to Sub Main() in the main module or to Form_Load() in the main form.
ChDrive App.Path
ChDir App.Path
- Wherever you have hard coded the full path to a file, remove the path leaving just the filename.
For example; Change “C:\Data\VisualBasic\VideoStore.mdb” to “VideoStore.mdb”.
- Make sure that the file being accessed is in the same location as the project that needs to access it.
| All items Copyright ©1996 - 2011 Mr. N. Chin. All Rights reserved | Conscious Vibes developed and maintained by Mr. Chin | Duplication of links and/or content is strictly prohibited. See: Terms of use |