Need help with a GUI checkbox

private: System::Void checkBox1_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
if(checkBox1->CheckState = CheckState::Checked)
{
chart1->ChartAreas[0]->AxisY->Minimum = 1;
chart1->ChartAreas[0]->AxisY->Interval = 1;

chart2->ChartAreas[0]->AxisY->Minimum = 1;
chart2->ChartAreas[0]->AxisY->Interval = 1;

chart3->ChartAreas[0]->AxisY->Minimum = 1;
chart3->ChartAreas[0]->AxisY->Interval = 1;
}
else(checkBox1->CheckState = CheckState::Unchecked)
{
chart2->ChartAreas[0]->AxisY->Minimum = 5;
chart2->ChartAreas[0]->AxisY->Maximum = 15;

chart1->ChartAreas[0]->AxisY->Maximum = 15;
chart1->ChartAreas[0]->AxisY->Minimum = 5;

chart3->ChartAreas[0]->AxisY->Maximum = 15;
chart3->ChartAreas[0]->AxisY->Minimum = 5;
}

}
This is the part of the code I am having trouble with.
I'm having trouble utilizing the checkbox with chart control. I want the checkbox to be an autoscale when you check it. It will autoscale the graph, and when you uncheck it, it will go back to normal. I wrote this, but it doesn't work. Help please!
I don't know exactly what CheckState is, but the assignment = in if/else is certainly wrong.

Replace = with == (comparing operator)
I tried fixing that, and that didn't fix my problem.
I'm getting an error, which is error C2143: syntax error : missing ';' before '{' for this. I don't understand why it is listing this error. I was hoping check state would go through the procedure if the box was check and unchecked.
it would be easier if you'd told me where the error is...

This is wrong:
else(checkBox1->CheckState = CheckState::Unchecked)

Change it to:
else if(checkBox1->CheckState = CheckState::Unchecked)
That worked! Thanks for you help!
Topic archived. No new replies allowed.