709-218-7927

The Landfall Garden House

60 Canon Bayley Road

Bonavista, Newfoundland

CANADA A0C 1B0

CPRGreaves@gmail.com

Home

Christopher Greaves

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

709-218-7927 CPRGreaves@gmail.com

Bonavista, Sunday, December 08, 2024 9:31 AM

Copyright © 1990-2024 Chris Greaves. All Rights Reserved.