Radiobutton text to string
Hello. I'm creating a simple program that randomizes answers in 3 radio buttons. The user will pick 1 answer. A button is pressed and the answer is checked against the real answer. I can't seem to be able to check the selected radiobutton text to the correct answer.
I have the correct answer defined at a global level.
I need to use a simple way to do this, so I figured this would be the best way:
decCorrectAnswer is the global variable for the already calculated correct answer.
RadioButton selectedRadioButton = (RadioButton)sender;
decimal decGivenCorrectAnswer = selectedRadioButton.Text.ToString("N2");
if (decGivenCorrectAnswer = decCorrectAnswer)
Error 1 The best overloaded method match for 'string.ToString(System.IFormatProvider)' has some invalid arguments
Error 2 Argument '1': cannot convert from 'string' to 'System.IFormatProvider'
Sorry. I'm new at this so I'm not understanding the way to check the selected radio button's text to a decimal variable.
Error 3 Cannot implicitly convert type 'decimal' to 'bool'