|
-
Sep 30th, 2000, 07:45 PM
#1
Thread Starter
Frenzied Member
Hi,
I have a control array of 3 option buttons on my form. I want to hit a command button which pops up a msgbox and let's me know which option index is currently selected.
Thanks,
Dan
-
Sep 30th, 2000, 08:02 PM
#2
Try this:
Code:
Private Sub Command1_Click()
For i = 0 To 2
opt = Option1(i).Value
If opt = True Then opt = Option1(i).Index: Exit For
Next i
MsgBox "Option1(" & opt & ")"
End Sub
-
Sep 30th, 2000, 08:12 PM
#3
Fanatic Member
hmm
on the click event of your command button
suppose option1(0), option1(1), option1(2) are your option buttons
do something like
if option1(0).value = true then
msgbox "0"
else if option1(1).value = true then
msgbox "1"
etc...
This is the answer in its simplest form
I am guessing you're new to VB
-
Oct 1st, 2000, 12:18 AM
#4
Hyperactive Member
Actually, in it's simplist form:
Since only one option box may be selected at any one time:
Code:
Option Explicit
Dim opt as Integer
Private Sub Option1_Click(Index As Integer)
' saves the selected option button index to a module variable
opt = Index
End Sub
Private Sub Command1_Click()
MsgBox opt
End Sub
Cheers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|