Status Bar - VB 6 Version - June 2002

I include a 'status bar' on most VB forms. Over the years I have rewritten and reused the code many, many times. I finally got smart about 2 years ago and included most of the code in one module [modStatusV2.bas]. I recently used the module and thought I'd share it - thus it becomes the June 2002 tip-of-the-month. Click here to view documentation for the VB.Net version.

The Demo Program

I created a VB 6 demo program to show how to use the 'Status' function. The demo program's screen:

frmStatusBar
Status Bar VB6 Demo

Using the Demo

Enter some text in the 'Status Text' box then click the command button. Text is shown in 'bold' if 'Critical' is checked. The message is persistent if 'Persistent' is checked - otherwise it is displayed for only 4 seconds.

Add to each Form

To use the 'Status' function add a status bar and a timer to each form on which you want to display a status message. In the demo I used the VB 6 version of the 'StatusBar' control. Add the Windows Common Controls to your project's tool box by selecting menu Project/Components for example:

Microsoft Windows Common Controls 6.0

Add the 'StatusBar' to your form by double-clicking the status control from the tool box, for example:

Toolbox

Add one panel to the status bar using the properties dialog, for example:

Status Bar Properties
Key is 'status' and AutoSize is '1-sbrSpring'.
Enter the key in lower case - it is case sensitive.

Next add a timer to your form. Name it 'tmrStatus'.

tmrStatus
Name the timer 'tmrStatus'.

Lastly add module 'modStatusV2.bas' to your project.

Calling 'Status' and 'StatusOff'

Function, Arguments Description
Status frm, sMsg [,bCritical] [,bPersistent] Call the Status function.
   frm Usually 'Me'. The form on which the message is to be displayed.
   sMsg The message to be displayed.
   bCritical If true, the text is shown in bold face and a beep is issued, optional, default is 'no'.
   bPersistent If true, do not clear the message after 4 seconds, optional, default is 'no'.
StatusOff frm Clear the Status message.
   frm Usually 'Me'. The form on which the status message is to be cleared.

The Demo Program Uses These Modules

Module - Click for More Info Description Used in the Demo To
modStatusV2.bas Contains functions Status and StatusOff The subject of this tip. Add it to your application to use the functions.
modConnectToWebSite.bas Connect to a web site Show this info when Help/Info is selected from the demo.

Download VB 6 Source Code

Click here to download the VB 6 source code [6k]. Click here to view documentation for the VB.Net version.

Previous Tip   Tip Index    First Tip

Home

Updated 2002/06/01