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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Create/Delete Frames at Runtime

Status
Not open for further replies.

yellowbusbon

Programmer
May 15, 2003
1
HK
My program creates Frames inside a scrollbox at runtime.
The Created Frames has a button to delete itself.
After the button is clicked and the frame is delete, an error will occur randomly sometimes.

The Code that create and delete frame is like this:

void __fastcall TMainForm::BtnCreateClick(TObject *Sender){
TMyChildForm *MCF = new TMyChildForm(NULL);
MCF->Parent = this->ScrollBox1;
}

void __fastcall TMyChildForm::BtnDeleteClick(TOject *Sender){
delete(this);
}

I guess the problem is because VCL still got something to do with the Child Frame which delete itself in the button handler. How can I avoid this?

Thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top