Quote:
Originally Posted by 6600gt
Main^ main = dynamic_cast<Main^>(this->MdiParent);
for(count = 0; count < 10; count++)
{
number = main->serialPort1->BytesToRead; //Error
}
|
This could be couple things. . . The problem could be line before also. . .
Something isn't initialized and there is a NULL Pointer and you are trying to assign a NULL pointer to a data slot. .
Looking in this instance my guess is there isn't Serial Communications between the PIC and the computer, and that serialPort1 is probably NULL ??
My suggestion would be when you get a problem like this is set a breakpoint couple lines before the error and then run till it gets the breakpoint and do System Watches on the important variables and use the Step Over and Step Into to go step by step through the for loop. . . If something is null it normally comes up as something in red text or a value that you know isn't correct in the watch window.