2
Answers

Getting an error after using ActiveForm in debug mode!!!

Ask a question
edua_11368

edua_11368

19y
2.1k
1
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.

Answers (2)