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?

Recommended Answers

All 3 Replies

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.