Pointer to a control is null?????Help!!!!
Hi, a very weird thing is going on with my code
I am using Borleand version 5.0 as my compiler
The problem is as follows:
On Form activate(of Product) I call a user created function to add items to a list check box. ( chkListTopping->Items->AddItem(tmpItem); ) Everything works fine.......
After that I open a qerry(qPmain->Open();) , which triggers the query's After Scroll event(occurs when query does move, first next...)
This event then calls UpdateChklist() a public function defined in the form header.....("Product.h")
This function looks at the currently selected record in the querry(first record) and reads a few values and then sets the checked property to true of the coresponding items in the checkbox.
But the line chkListTopping->Checked[i] = true; gives me an error
the error occurs because the pointer chkListTopping is null;
I deeply wonder banging my head on the desk.........how can that bee when just a few moments ago chkListTopping was not null and I was able to use it and add some items to the list.
I tripled checked if the spelling is correct and the bug is not as simple as that.
P.S If the event AfterScroll is triggered after the form has been loaded, then the function UpdateChkList which is called by the event has no problem editing the listbox..........(the pointer chkListTopping is not null). This seems to happen only while the form is still in its Creation procedure.