Developers Dev Header Right.gif (1326 bytes)


Developer Home
Tricks and Tips
Submissions
Developer Links
Graphic Art Links

Home Page

Developers

Tricks and Tips

This section is intended to provide 'Tricks and Tips' on all subjects related to software development.  If you have any that you would like to share please go to the submissions page.

Auto-searching by entering text in a combo box
Just like those list boxes in Microsoft Access where you type the first couple of letters and the entry you are looking for appears.
Creating Short Arrays Using the Variant Data Type
Did you know the Variant data type can be used as a container for an array?  No, then click the link above.
Creating Win32 region windows
Wow!  Round windows, oval windows and even star shaped windows.  This article explains how to create non-rectangular windows.  Splash screens will never be the same again!
Determining whether a file exists
In the absence of an IfExists(filename) function here is a function that will determine if a file exists or not before you attempt to open it.
Drag-and-drop in Visual Basic 5.0.
It's not just for Word anymore! Visual Basic 5.0 offers control properties and events that let you drag and drop just as you can in Word and other Microsoft Office applications.
Is VB Running? A Simple Function Will Tell You
You can write a one-line function that will tell you if Visual Basic 5.0 is in run mode or design mode.
Showing long ListBox entries as a ToolTip
Sometimes the data you want to display in a list is too long for the size of ListBox you can use. When this happens, you can use some simple code to display the ListBox entries as ToolTips when the mouse passes over the ListBox.
Use ParamArray to Accept an Arbitrary Number of Parameters
You can use the ParamArray keyword in the declaration line of a method to create a subroutine or function that accepts an arbitrary number of parameters at runtime.
Use FileDSNs to ease ODBC Installs
If you're using an ODBC connection to your database, you can ease the process of installing the application on workstations by using the FileDSN (data source name) instead of the more-common UserDSN.
Creating Your Own VB5 Templates
You can create your own VB Templates quickly and easily. If you find that you are adding the same routines to your forms, classes, BAS modules, etc. you can build generic versions and place them in the Templates folder tree of VB5.

Up_Brown.gif (1077 bytes) Top of Page

 

Increment and decrement dates with the [+] and [-] keys
If you've ever used Quicken, you've probably noticed a handy little feature in that program's date fields.
Add Dithered Backgrounds to your VB Forms
Ever wonder how the SETUP.EXE screen gets its cool shaded background colouring? This colour shading is called dithering, and you can easily incorporate it into your forms.
Selecting all text when a TextBox gets focus
When you present the user with default text in a TextBox, you'll often want to select that text when the TextBox gets focus. That way, the user can easily type over your default text.
Dealing with Null strings in Access database fields
By default Access string fields contain NULL values unless a string value (including a blank string like "") has been assigned. When you read these fields using recordsets into VB string variables, you get a runtime type-mismatch error.
Dragging items from a list to another one
Here's a way that you can let users drag items from one list and drop them in another one.
Getting sensible Win32 API call errors
Most of the Win32 API calls return extended error information when they fail. To get this information in a sensible format, you can use the GetLastError and FormatMessage APIs.
Specifying maximum lengths in a ComboBox
The ComboBox control doesn't have a MaxLength property like a TextBox does.
Clearing all fields and combo boxes on a form
Sometimes you want to clear all the fields and combo boxes on a data-entry form.
Preventing multiple instances of VB apps
You can easily prevent users from running multiple instances of your programs by taking advantage of the PrevInstance property of the App object.
Retrieving the network logon name
You can easily retrieve a user's network logon name by using the following API call:

Up_Brown.gif (1077 bytes) Top of Page

 

Case-conversion on the fly
If you want to convert text to uppercase as it's entered in a text box, just create an Upper function and call it from the text box's keypress event
.
Create a Directory Structure
Here's a way that you can create a directory structure even if the underlying directories do not exits.
A useful group of Bit Manipulation Functions
These functions are designed to assist in bitwise manipluations of Long values.
Determining the 'Start Mode' Windows is in
determine whether Windows is running in 'Safe Mode' or 'Normal Mode'.
How to hide the 'Start Menu' bar
The Start Menu bar in Windows 2000, NT, 95 or 98 is actually a window and can be manipulated using windows API calls.
How to get the current user name
This routine will return the current user name.
How to hide the Mouse cursor
You can use the API function Showcursor to control the visibility of the mouse cursor.
Delete a file to the Recycle Bin
The Recycle Bin is great for stopping files for permanently being deleted off your hard disk.

Up_Brown.gif (1077 bytes) Top of Page

 

Brown_Line.gif (372 bytes)

If you have any queries email:
developer@may-computing.com