Difference between revisions of "The Basics of VB6"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
m
m
Line 48: Line 48:
 
  Public Const dbtContact = "contact"
 
  Public Const dbtContact = "contact"
  
=== StatusBar Control ===
 
 
Visual BASIC 6.0 Status Bar Control (MFC status bar control) is an ActiveX control.  To enable select "Microsoft Common Control" option from the component dialog box.  A StatusBar control provides a window, usually at the bottom of a parent form, through which an application can display various kinds of status data. The StatusBar can be divided up into a maximum of sixteen Panel objects that are contained in a Panels collection.
 
 
* Right-click on the Status Bar to bring up the Properties for the control
 
* Select the Panels Tab.
 
* Use the Index tab and the Insert Panel Button to add additional panels.
 
* Use the Style Drop-down list box to select a different type of information to appear in a panel.
 
  
 
 
 
 

Revision as of 10:54, 2 February 2008

These notes can be organized later.

Select Case (Switch)

CASE in Visual BASIC does not "fall through" like in C.

 Select Case Button.Key
   Case "ListCache"
     mnuListCache_Click
   Case "Refresh"
     mnuRefresh_Click
   Case "simmode"
     cmdSimMode_Click
 End Select
 Select Case tcpClient.State
   Case 0
     tcpClient.RemoteHost = cboRemoteHost
     SessionConnect
   Case 7
     lblStatus.Caption = "Connected"
   Case 9
     lblStatus.Caption = "Connection Error"
 End Select

Case based on more than one condition

 Select Case True
   Case strMessage Like "*OK*" And lblStatus.Caption = "Connected"
   blnReceivedAll = True
 Case strMessage Like "*OK*" And lblStatus.Caption = "retrieving."
   lblStatus.Caption = "retrieving.."
   blnReceivedAll = True
 Case Else
   Set LoopTime = New TimerClass: tmrDisconnect.Enabled = True
 End Select

Public Declarations

Public strCurrentTool As String
Public fMainForm As frmQAB
Public cn As ADODB.Connection
Public rsCompanies As ADODB.Recordset
Public Const dbtContact = "contact"