reading size using radio buttons
-
i wrote this code to retrieve size from the database private void grpSize_Enter(object sender, EventArgs e) { string size = ""; if (rdbLrg.Checked) { size = "Large"; } if (rdbReg.Checked) { size = "Reg"; } if (rdbSupa.Checked) { size = "Supa"; } i am using this to pass it to the next from frmOrderDetails order = new frmOrderDetails(lstItems.SelectedValue.ToString(),rdbSupa.Checked.ToString()); order.Show() but what it does shows me true when i click the size i want and show false when i click other button i want it to retrieve the size i putted on the database
-
i wrote this code to retrieve size from the database private void grpSize_Enter(object sender, EventArgs e) { string size = ""; if (rdbLrg.Checked) { size = "Large"; } if (rdbReg.Checked) { size = "Reg"; } if (rdbSupa.Checked) { size = "Supa"; } i am using this to pass it to the next from frmOrderDetails order = new frmOrderDetails(lstItems.SelectedValue.ToString(),rdbSupa.Checked.ToString()); order.Show() but what it does shows me true when i click the size i want and show false when i click other button i want it to retrieve the size i putted on the database
-
i wrote this code to retrieve size from the database private void grpSize_Enter(object sender, EventArgs e) { string size = ""; if (rdbLrg.Checked) { size = "Large"; } if (rdbReg.Checked) { size = "Reg"; } if (rdbSupa.Checked) { size = "Supa"; } i am using this to pass it to the next from frmOrderDetails order = new frmOrderDetails(lstItems.SelectedValue.ToString(),rdbSupa.Checked.ToString()); order.Show() but what it does shows me true when i click the size i want and show false when i click other button i want it to retrieve the size i putted on the database
Why are you passing the ToString of a boolean? That is asking for trouble. If all the radio buttons are in the same group you should add else before the 2nd and 3rd if statements. No reason to check for all 3 every time. I also don't understand why you wouldn't pass size to your second form.