Resolved How can something be both expected and invalid?

Cam

New member
Joined
Aug 15, 2020
Messages
1
Programming Experience
1-3
624DE93D-7B3C-4732-A12F-198DF72CD5C5.jpeg


I’m working on a hobby project. I know that it needs to end with “checked()), but when I do that, it says the ‘)’ is invalid. Then when I remove it, it says this. How do I get past this?
 
Please do not send screenshots of your code. Pastw the actual code in code tags, and then also paste in the exact error(s) in code tags.
 
Although C# is more forgiving about recovering from cascading errors, there is a limit. Chances are there was one or more errors before the error regarding the closing parenthesis. Chances are there would have been some error about radiobutton1 && radiobutton2. Or some error about checked(). Or some error about trying to compare radiobutton2 with check()
 
The image appears to be showing:
if (radioButton1 && radioButton2 != checked()
Are you calling a method or just trying to close the if expression? Are those control names or boolean variables?
If you're trying to compare Checked state of radiobuttons the expression is wrong and need to written like this:
C#:
if (!radioButton1.Checked && !radioButton2.Checked)
 
Back
Top Bottom