I don't know how to do this in windows application. I have a query to select all from a table and bind its value to the objects but I don't know how to do this with radiobuttons.

I usually do my code like this in ASP.net for radiobutton to determine the check value. radioGender.SelectedValue = dr("IntendBreed").ToString() In windows applications, there's no radiobuttonlist and no selectedvalue etc. How to do this?

6 Years
Discussion Span
Last Post by Momerath

Radio buttons have a Checked property that holds a boolean value. You'll have to return a boolean to set it, maybe something like radioGender.Checked = dr("IntendBreed").ToString() == "American Shorthair"; .

If you are trying to set the text of the radiobutton (and not if it is active or not), then you'd use the Text property radioGender.Text = dr("IntendBreed").ToString()


How to return a boolean set as radioGender.Checked = dr("IntendBreed").ToString() doesn't work. Cannot because convert bool to string


Did you not notice the rest of the line where I compare it to something? Comparisons return boolean values.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.