Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListCtrl Member Variable

Status
Not open for further replies.

sweep123

Technical User
May 1, 2003
185
GB
Using a list control on a dialog, I have created (via the Class Wizard) a member variable (Control type = CListCtrl), but I keep getting the following error:-

c:\Demo4\DlgData.cpp(612): error C2228: left of '.InsertColumn' must have class/struct/union type.

This member variable is not created correctly as I dont get the structure when I type m_MtList. in the code.

Is this a bug in Visual Studio.

I have (working) a ListCtrl in another dialog working OK, and have used that to check this one, but dont understand whats wrong?

Sweep
 
>Is this a bug in Visual Studio.

More likely an error a couple of inches from you monitor. :)

There is nothing "magic" with the variables created by the ClassWiz (all those fancy //{{AFX comments are just means for ClassWiz to know where to put/look for code).

Just check that the class header contains the member you expect to be defined there, if not just put it there yourself.


/Per
[sub]
if (typos) cout << &quot;My fingers are faster than my brain. Sorry for the typos.&quot;;
[/sub]
 
>> I have created (via the Class Wizard) a member variable
>> (Control type = CListCtrl), but I keep getting the following error:-

Something went wrong in that member creation step. Use the class wizard to delete the member variable. Then create it again. If the problem persists post the class wizard generated lines of code for the member variable. You can find them simply by saving the .h and .cpp files into copies before you add the member using class wizard and then use Windiff on the files after creating the member variables.


-pete
 
OK, the member variable is created, but not it seems as a CListCtrl.
The dialog did have more than 255 controls on it at one time. I am wondering if this is the problem.

To re-cap if I delete the variable -> compiler = variable not defined.
If I re-create it (Class Wizard or by hand) -> compile error C2228: left of '.InsertColumn' must have class/struct/union type. If I comment out the code using the variable - > OK.
Sweep
 
>> The dialog did have more than 255 controls on it at one
>> time. I am wondering if this is the problem.

It certainly is A problem. Don't know if it is this problem.

In my previous post i asked you to post specific code if the problem persisted. What happened to that?


-pete
 
I did not post the code a could see no reason that the code was in error. A I did by hand and I also let the Wizard do it -> same result!

I think the problem was the resources associated with the dialog that had over 255 control.

I copied everything over and started again, deleting the dialog that I thing was the problem.

Everything works OK now.

Just during this phase Visual Studio .Net crashed a few times also.

Only one question, are they any tools that can check the integrity of your project, as sometimes on a network you lose connections.

Sweep.
 
>I did not post the code a could see no reason that the code was in error

Ok, but the compiler was of a different opinion. And the compiler is quite often right.

>I think the problem was the resources associated with the dialog that had over 255 control.

Well, as pete hinted, having 255 controls in a dialog certainly is a problem, compiling error or not.

You could for example see yourself how hard it was to track down where the real error was.

>I copied everything over and started again, deleting the dialog that I thing was the problem.

Cheater!



/Per
[sub]
if (typos) cout << &quot;My fingers are faster than my brain. Sorry for the typos.&quot;;
[/sub]
 
Just for my $0.02,
&quot;Only one question, are they any tools that can check the integrity of your project, as sometimes on a network you lose connections.&quot;

Why don't you work on your hard drive ? - your not affected by network outages, and you then have a backup as well ?
Just make sure that you frequently copy any changed files that you are working on back up to teh network
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top