The Basics of VB6

From Free Knowledge Base- The DUCK Project: information for everyone
(Redirected from Unsorted VB6 Notes)
Jump to: navigation, search

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"