Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically setting a default RadioButton Selection

Status
Not open for further replies.

cosmoh2o

Programmer
Jul 22, 2002
92
US
Does anyone know how to dynamically set a default RadioButton selection?

I am looping through a "for each" loop to dynamically add radiobuttons with a RadioButtonsList object. When a value being added is the same as a previously stored value, I would like that item in the RadioButtonList to be selected by default.

Below is some example code:
Dim s as String = "some data"
Dim o as Object
Dim al as ArrayList
// At this point an ArrayList is returned with
// values to be stored in RadioButtonList
For each o in al
RadioButtonList.Items.Add(o)
if(s.compare(s, o.Gettype.ToString)) Then
// I want THIS radio button to be selected
// automatically
end if
Next

Thanks in advance for any help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top