I'm new to c# and the visual studio, done a bit in visual basic before. Any help much appreciated.
I'm trying to get a form to change a variable depending on if a checkbox is checked or not. So the user clicks a button and the variable has a value, but if the checkbox is checked it has another.
So I'm trying to have
if (Othersite.Checked)
site = "Site B";
else
site = "Site A";
If I put it as this, the message at the bottom says "Togglebutton.checked must be on the left of += or -="
However, if I put
if (Othersite.Checked += true) site = "Site B"; else site = "Site A";
The error is "CS0029 Cannot implicitly convert type 'bool' to 'System.Windows.RoutedEventHandler'"
Where am i going wrong?
I've tried looking around on here, but can't see anything too similar. Or the results haven't worked in the visual studio.
Aucun commentaire:
Enregistrer un commentaire