I did as you said but I have encountered in another problem. when i create the panel the oncreatecontrol is called and all the controls are created and painted in the panel but when i create the panel again not all the controls are painted in the panel and only one is painted in the panel. can you tell me what is the problem?