VBnet FAQ Code
Visual Basic Developers Resource Centre
Updated December 26, 2011

   
Category
Topic
FAQ Q&A Frequently Asked Questions
Not a big list, just some of the more popular basic questions about coding in VB.


Files
vb3
vb4-16
vb4-32
vb5
vb6
Pure VB: Retrieve Multiple Filenames from the Common Dialog Control
Code to extract the filenames returned from a standard VB File Open Common Dialog under Win32/VB4-32, where the application is providing the common dialog with both cdlOFNAllowMultiselect and cdlOFNExplorer specified. For vb4-32, vb5, vb6

Pure VB: Blasting a Text File into a String or Text Box in One Call
Loading a text file up to the maximum file size supported by the control (version-dependant) in one statement.

Pure VB: Save a Text File from a String or Text Box in One Call
Saving the contents of a textbox to disk in one statement.



Forms
vb3
vb4-16
vb4-32
vb5
vb6
SetWindowPlacement: Activating a Window Without Focus
Show any window without focus using this simple API routine.

Pure VB: Centering a Form or Dialog on the Screen
Code to centre any form on the screen.

Pure VB: Centering a Form or Dialog in its Parent Form
Code to centre any form to its parent form. This is primarily for centering dialogs within a parent window where the parent may be positioned anywhere on-screen.

SetWindowPos: Create a Topmost Window
The ever-popular API method to create a 'topmost' window.

SetWindowLong: Create a Floating Window
APIs to create a floating window which follows its parent when minimized or restored.
* Note: VB5 and VB6 users can get this functionality without using the API by passing the parent or calling form of the dialog/form as the second parameter in the form Show command. See the link above or the VB help for more information on the Show command.



Images
vb5
vb6
GIF Licensing Issues for Microsoft Development Products
Exchange between myself and Unisys regarding GIF usage in VB applications. Aug 27.99  Repost


Miscellaneous
vb3
vb4-16
vb4-32
vb5
vb6
mciSendString: Eject Media from a CD-ROM
A one-line API to eject the CD. For vb4-32, vb5, vb6 only

waveOutGetNumDevices: Wave Compatibility Test
A single API call is all it takes.



Shell (32-bit)
vb4-32
vb5
vb6
GetExitCodeProcess: Determine when a Shelled App has Ended
How to pause a VB app while a Shelled process is active.

WaitForSingleObject: Determine when a Process has Ended
How to start an external process using CreateProcess and pause while the process is active.

WaitForSingleObject: Determine when a Shelled App has Ended
Alternate code using Shell and OpenProcess to pause while the process is active.



Shell (16-bit)
vb3
vb4-16
GetModuleUsage: Determine when a Shelled App has Ended (16-bit)
How to pause a VB app while a Shelled process is active.

GetModuleHandle: Determine if a Specific App is Already Running (16-bit)
How to use GetModuleUsage and GetModuleHandle to determine if a specific executable is already running.



Sort Methods
vb3
vb4-16
vb4-32
vb5
vb6
Pure VB: Quick, Shell, Bubble and Selection Sort Performance Comparisons
Code for the 4 sorting methods, along with speed comparison code.

Pure VB: Applying and Understanding the QuickSort
Detailed description on the workings of the QuickSort.



Text Box
vb3
vb4-16
vb4-32
vb5
vb6
Pure VB: How to Highlight Textbox Text on Gaining Focus
Two little lines of code are all you need!


Timer
vb3
vb4-16
vb4-32
vb5
vb6
Pure VB: Using a Timer Control as an Alarm
Simple non-API code to utilize the VB Timer control as an alarm.


 

 
 

PayPal Link
Make payments with PayPal - it's fast, free and secure!

 
 
 
 

Copyright ©1996-2011 VBnet and Randy Birch. All Rights Reserved.
Terms of Use  |  Your Privacy

 

Hit Counter