I am building a VB.NET PC application using VS 2008 and .NET Framework 3.5.
I am trying to dispose a control (a button) created programmatically in a dialog popup (by executing code connected to another button).
My code is: Me.Controls("btnMXReset").Dispose(), where btnMXReset is the name of the button.
My code compiles without error, but crashes on execution. The error message tells me nothing of value ("Object reference not set to an instance of an object").
Oddly, I'm using exactly the same syntax to dispose of User Controls on the popup, and that code works.
Can anyone supply me with the correct syntax?
Thank you, Stu Engelman