Getting an error after using ActiveForm in debug mode!!!
Hello,
After using method activeform to get the active form in my app, i try to clear all controls from the form so i can add new controls to it, just like this:
Form currentForm = Form1.ActiveForm;
currentForm.Controls.Clear();
When i run in debug mode, i get an exception for Object reference not set to an instance of an object. But if i run it without debbuging it works ok.
Does anybody know why this happens?
Thank you.
e.