Simple Question

Jan 16, 2012 at 11:52pm
Well the bit of code I'm about to show makes what I'm trying to do self explanatory :

1
2
3
4
5
6
void Form1::label3_Click(System::Object^  sender, System::EventArgs^  e) {
	if(checkBox2->Checked)
	{
	this->label3->BackColor = System::Drawing::Color::Lime;
	this->label3->Text = "Test";
	}


It compiles fine though after checking my checkbox it doesn't do anything. With this setup it'l only do as I want it to when I click on the actual label... I've tried using this on Form1_Load but it has no effect. Any ideas?
Last edited on Jan 16, 2012 at 11:52pm
Jan 17, 2012 at 12:33am
I believe there is a CheckedChanged event.
Last edited on Jan 17, 2012 at 12:37am
Jan 17, 2012 at 12:52am
Looks like that function will trigger when you click the label instead of the checkBox.
Jan 17, 2012 at 1:05am
closed account (o1vk4iN6)
You're not really explaining what you want it to do, this also seems to be the third thread you made for the same question.

What you want is the event for when checkbox2's state is changed. The event listener it looks like you have there is for when label3 is being clicked. Create a new event listener for when checkbox2's state is changed.
Jan 17, 2012 at 2:20am
Figured it out, I had to put it on the checkchange event. Thanks @ naraku & charji
Topic archived. No new replies allowed.