GoldenJag
asked on
Interaction Choose Method
Could someone give me an example of how to use the choose method in vb?
Thanks!
Thanks!
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
You'll still need a method of determining the arguments for the choose function.
(Bar in mind that every argument is evaluated for it).
For options that might change a combo or listbox is a bit more normal.
(Bar in mind that every argument is evaluated for it).
For options that might change a combo or listbox is a bit more normal.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
"i was looking for a way to have a user choose between two options."
You could use the MsgBox() function and have the user select Yes/No to indicate their preference for the first/second option:
Private Sub Command1_Click()
Dim msg As String
msg = "How often do you like your system to crash?" & vbCrLf & vbCrLf & _
"(1) Just before I click the Save button on important documents." & vbCrLf & _
"(2) Just before I hit Print on the bosses reports." & vbCrLf & vbCrLf & _
"Select YES for (1) ... or ... NO for (2)"
Dim result As Integer
result = MsgBox(msg, vbYesNo, "Crash Preference")
Select Case result
Case vbYes
MsgBox "You selected Option 1"
Case vbNo
MsgBox "You selected Option 2"
End Select
End Sub
You could use the MsgBox() function and have the user select Yes/No to indicate their preference for the first/second option:
Private Sub Command1_Click()
Dim msg As String
msg = "How often do you like your system to crash?" & vbCrLf & vbCrLf & _
"(1) Just before I click the Save button on important documents." & vbCrLf & _
"(2) Just before I hit Print on the bosses reports." & vbCrLf & vbCrLf & _
"Select YES for (1) ... or ... NO for (2)"
Dim result As Integer
result = MsgBox(msg, vbYesNo, "Crash Preference")
Select Case result
Case vbYes
MsgBox "You selected Option 1"
Case vbNo
MsgBox "You selected Option 2"
End Select
End Sub
ASKER
is that what the choose method does?