-
radioButton
I have put a radiobutton to a Form that I have named radioButton1.
As I know a radiobutton can have 2 states, true and false.
What I wonder here is for this code example that will show a messagebox if radioButton1 is pressed.
However this does not compile.
Code:
if (radioButton1 = true)
{
MessageBox::Show("radioButton1is pressed");
}
I tried to find these members to radioButton1 but I cant find these members to the radioButton1 class. I do find hundreds of others but not these 2.
Code:
radioButton1->GetState()
radioButton1->IsChecked()
-
Code:
if (radioButton1 == true)
{
System.MessageBox.Show("radioButton1is pressed");
}
something like this should compile...
-
Here is code checked in C#
Code:
if (this.radioButton1.Checked == true)
{
System.Windows.Forms.MessageBox.Show("selected");
}
-
I think that did it really. I was trying out to make a private class bool variable and inside the radiobutton eventhandler make this variable to evaluate to true or false and then refer to that variable if that variable was true or false. That did also work but kind of "go around". thanks for your solution.