0
Good morning ! I created a small system that uses some radio button components, but when I do not mark any the system generates an error, someone knows how can I make a conference call if some radio button has been marked. Below is the code:
RadioButton rbnTurno = groupBox2.Controls.OfType<RadioButton>().SingleOrDefault(r => r.Checked);
RadioButton rbnCategoria = groupBox1.Controls.OfType<RadioButton>().SingleOrDefault(r => r.Checked);
RealizarProcessamento(rbnTurno, rbnCategoria, Convert.ToDouble(textBox2.Text), Convert.ToDouble(textBox1.Text));
What exactly does the error generate? Better if it’s the whole stacktrace.
– Andrew Paes
You should probably be running and the variable
rbnTurno
should be null because it has no radio selected, hence when you pass to the methodRealizarProcessamento
error. You have to treat this, and even display a message if applicable.– Ricardo Pontual
Hello ! I was able to solve, and was just treating to check if there is a radio button selected, then it worked out. thanks...
– Diógenes