In the form1 I'm loading a datagridview with data from my database, and when I double clic on a row of the datagridview it launches the form2 and it will be filled with the info of that row. I'm able to fill the textboxes and comboboxes of the form2, but my problem comes here, in the database I have a column that requires and answer of yes or no, that means, is a string, and according to that answer I want to check one of two radiobuttons of the form2, when I try to use an if statemant like this one:
if (datacontext.married = "yes")
{
radiobutton1.checked
}
else
{
radiobutton2.checked
}
It gives me an error saying that I cannot convert ..... bool to string or viceversa, and I tried with a switch statement too.
I'm still a beginner in C#, if I'm using something in the wrong way, I'll be glad to hear your suggetions. What can I do?
Aucun commentaire:
Enregistrer un commentaire