I've a C# Windows Form Application that contains multiple Groups , each group contains some of Radio Buttons.
I want to insert values of each group to my ACCESS database table.
I’am trying to return from every function like doing
private void Get_Gender(RadioButton GenderButton)
{
if (GenderButton.Checked)
{
Return GenderButton.Text;
}
}
private void Get_Age(RadioButton AgeButton)
{
if (AgeButton.Checked)
{
Return AgeButton.Text;
}
}
private void Get_Interest(RadioButton InterestButton)
{
if (InterestButton.Checked)
{
Return InterestButton.Text;
}
}
Then trying to pick them from functions like
String Gender = Get_Gender(I don’t know what to put here);
String Age= Get_Age(I don’t know what to put here);
String Interestr = Get_Interest(I don’t know what to put here);
And then create connection..(this will be no problem)
OleDbConnection con = new OleDbConnection();
Command cmd = new oleDbCommand(“INSERT into tbl (Age, Gender, Interest) “+”values(@age, @gend, @int”, con);
Query will not be problem ,
but values of those three groups.
Getting those values (@age, @gend, @int”, con);
getting me crazy… Is There a simple way to get just the checked RadioButton by code instead of checking every Radio Button in each group whether it is checked or not ? Pls se my image.. to understand more. Pls help guys and thank you in advance.