|
-
May 28th, 2010, 11:53 AM
#1
Check Box
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.
Code:
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.
Code:
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.
-
May 29th, 2010, 05:04 AM
#2
Re: Check Box
It is impossible to say why C2059 is printed, without looking the whole h-file. C2227 is printed because there is no checkBox1 class member. Post the whole code to see what happens.
-
May 29th, 2010, 02:27 PM
#3
Re: Check Box
Thanks for the reply, I think I get the solution already, I was totally my fault. Anyway, thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|