416-621-9348 cgreaves@chrisgreaves.com Visit www.ChrisGreaves.com for this image! Chris_GEDC1894_Head (Small).JPG
Home Services Products

Finessing The Data

In this lesson we will flesh out the action to be taken when the user selects a list box item. We present these snippets of code as morsels to whet your appetite.

We would like to take special action for individual province codes. In particular if the selected province is Ontario or Manitoba we would like to display a message:

Private Sub lbProvinces _Click()
Dim strProv As String
strProv = Me.lbProvinces.List(Me.lbProvinces.ListIndex)
Me.tbInput = strProv
Dim strMsg As String
strMsg = ""
Select Case strProv
Case "ON"
strMsg = "A great province"
Case "BC"
strMsg = "Visit Telegraph Creek"
Case Else
End Select
If strMsg <> "" Then
MsgBox strMsg
Else
End If
End Sub

Loading

Toronto and Mississauga, Sunday, December 05, 2010 3:21 PM

Copyright © 1996-2010 Chris Greaves. All Rights Reserved.