Control Array help

stevenafc2
03-29-2004, 06:09 PM
Hello

Ive got a series of Options buttons on a form (all in an array). Now im trying to find out what the option button array number is for the selected option. IE

frmSalesScreen.Label2.Caption = OptDiscount( [--- What goes here --- ] ).Caption

I know if i insert 1, or whatever it will work, i just need something that will input the number of the selected radio button.

00100b
03-29-2004, 06:39 PM
You can iterate through the controls in the control array, checking to see which control's Value property = True. When found, assign the Caption to the Label and exit the loop.

Private Sub Command1_Click()
Dim intIndex As Integer
For intIndex = Option1.LBound To Option1.UBound
If Option1(intIndex).Value = True Then
Label1.Caption = Option1(intIndex).Caption
Exit For
End If
Next intIndex
End Sub

stevenafc2
03-29-2004, 06:43 PM
Excellent thanks alot.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum