radio button question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I have a bunch of radio buttons that aren't part of a group box.
I'm using code to check the values from a SQL server database, then check whichever ones should be.
But, they are acting as though they are a part of a group box...only one box can be checked at a time.
I have 6 labels, and for each label, a yes radio box and a no radio box. Only the final radio button is ever checked.
the code is as follows:

If drv("STR_RECCE_WORK").ToString = "YES" Then
radRecceYes.Checked = True
radRecceNo.Checked = False
ElseIf drv("STR_RECCE_WORK").ToString = "NO" Then
radRecceNo.Checked = True
radRecceYes.Checked = False
Else
radRecceNo.Checked = False
radRecceYes.Checked = False
End If
If drv("STR_BIO_FIELD_WORK").ToString = "YES" Then
radBioY.Checked = True
radBioN.Checked = False
ElseIf drv("STR_BIO_FIELD_WORK").ToString = "NO" Then
radBioN.Checked = True
radBioY.Checked = False
Else
radBioN.Checked = False
radBioY.Checked = False
End If
If drv("STR_LAYOUT_WORK").ToString = "YES" Then
radLayoutY.Checked = True
radLayoutN.Checked = False
ElseIf drv("STR_LAYOUT_WORK").ToString = "NO" Then
radLayoutN.Checked = True
radLayoutY.Checked = False
Else
radRecceNo.Checked = False
radRecceYes.Checked = False
End If
If drv("STR_CRUISE_WORK").ToString = "YES" Then
radCruisedY.Checked = True
radCruisedN.Checked = False
ElseIf drv("STR_CRUISE_WORK").ToString = "NO" Then
radCruisedN.Checked = True
radCruisedY.Checked = False
Else
radRecceNo.Checked = False
radRecceYes.Checked = False
End If
If drv("STR_TRAVERSE_WORK").ToString = "YES" Then
radTraversedY.Checked = True
radTraversedN.Checked = False
ElseIf drv("STR_TRAVERSE_WORK").ToString = "NO" Then
radTraversedN.Checked = True
radTraversedY.Checked = False
Else
radRecceNo.Checked = False
radRecceYes.Checked = False
End If
If drv("STR_PAINTED_WORK").ToString = "YES" Then
radPaintedY.Checked = True
radPaintedN.Checked = False
ElseIf drv("STR_PAINTED_WORK").ToString = "NO" Then
radPaintedN.Checked = True
radPaintedY.Checked = False
Else
radRecceNo.Checked = False
radRecceYes.Checked = False
End If

Thanks in advance.
amber
 
RadioButtons will group together when put in any container control,
including a Form. To separate them into groups, you need to place grouped
RadioButtons in their own Panel, GroupBox, etc. I am not aware of any other
way around this, other than just using the CheckBox control instead.

Brian Davis
http://www.knowdotnet.com



amber said:
Hello,
I have a bunch of radio buttons that aren't part of a group box.
I'm using code to check the values from a SQL server database, then check whichever ones should be.
But, they are acting as though they are a part of a group box...only one box can be checked at a time.
I have 6 labels, and for each label, a yes radio box and a no radio box.
Only the final radio button is ever checked.
 
Amber,

You will have to place each pair of Yes or No radio button in a Panel. The
following code will work then.
By Default Radio Button(s) are part of the Form, and only one will be
selected. This behavior is by design

VJ

amber said:
Hello,
I have a bunch of radio buttons that aren't part of a group box.
I'm using code to check the values from a SQL server database, then check whichever ones should be.
But, they are acting as though they are a part of a group box...only one box can be checked at a time.
I have 6 labels, and for each label, a yes radio box and a no radio box.
Only the final radio button is ever checked.
 
Hi Amber,

You are giving the answer yourself in this message.
But, they are acting as though they are a part of a group box...only one
box can be checked at a time.

Use a checkbox if you want to check. A Radio button is to push.

I hope this helps?

Cor
 
Back
Top