nerrazzuri
May 28th, 2010, 11:53 AM
I'm currently learning how to add in a checkbox for a windows form. This was the example of checkbox codes to activate the main.cpp codes.
private:
void checkBox1_CheckedChanged(System::Object ^ sender, System::EventArgs ^ e)
{
if (checkBox1->Checked)
{
checkBox1->Text = "Checked";
}
else
{
checkBox1->Text = "Unchecked";
}
}
But when I compile it, this is my error.
error C2059: syntax error : 'private'
error C2227: left of '->Checked' must point to class/struct/union/generic type
type is ''int''
error C2227: left of '->Text' must point to class/struct/union/generic type
type is ''int''
error C2227: left of '->Text' must point to class/struct/union/generic type
type is ''int''
Why is that 'private' has syntax error? And what is the class/struct/union/generic type mean?
Thanks in advance.
private:
void checkBox1_CheckedChanged(System::Object ^ sender, System::EventArgs ^ e)
{
if (checkBox1->Checked)
{
checkBox1->Text = "Checked";
}
else
{
checkBox1->Text = "Unchecked";
}
}
But when I compile it, this is my error.
error C2059: syntax error : 'private'
error C2227: left of '->Checked' must point to class/struct/union/generic type
type is ''int''
error C2227: left of '->Text' must point to class/struct/union/generic type
type is ''int''
error C2227: left of '->Text' must point to class/struct/union/generic type
type is ''int''
Why is that 'private' has syntax error? And what is the class/struct/union/generic type mean?
Thanks in advance.