View Single Post
  #12   Spotlight this post!  
Unread 30-12-2006, 19:59
6600gt's Avatar
6600gt 6600gt is offline
Registered User
AKA: Lohit
FRC #0226 (Hammerhead)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Troy, MI
Posts: 221
6600gt is a jewel in the rough6600gt is a jewel in the rough6600gt is a jewel in the rough
Re: Visual C++ 2005 Designer

Quote:
Originally Posted by Bob22341 View Post
Your problem comes when "child" calls "parent"

In c++ once you have included a file once, you can't do it again without causing build errors. You create a continual loop with including parent and chile again and again.

If you want to go into inheritance issues and calling parent functions you can, there is an easier way. Create another file called "parenta" and copy over all of the code from "parent" Then slightly change all of the function and class names to avoid build errors, and your almost done.

Change "child" to call "parenta" instead of "parent" and problem solved.

"parent" should include "child" which should include "parenta"

Hopefully that solves your problem
This is not for the null reference exception, is it?

Thanks, anyway, but I think I got the original problem one fixed. The dynamic cast thing seems to be working. This program is already taking much longer than excepted...quite frustrating.

Again, thanks...I really need to get going on this thing.



Ok here is my function in DataView.cpp:

Quote:

Main^ main = dynamic_cast<Main^>(this->MdiParent);

for(count = 1; count < 11; count++)
{
while(main->serialPort1->BytesToRead < 1);

value = main->serialPort1->ReadByte();
value <<= 8;
value += main->serialPort1->ReadByte();

List_Select(count, value);

} // FAILS right after this if there is line after

main->done_flag = 1; //Here
main->~Main(); //Or here if the above line is commented out
System.NullReferenceException

I don't get it: I am just calling something else form the main after the ReadByte(), but I get an Null exception.

Any Ideas?

Last edited by 6600gt : 30-12-2006 at 20:06.