K
Ken Arway
Using C#, I have a Windows form app (MainForm) which contains a label (MainFormLabel) and a composite User Control (UC1). UC1 consists of a groupbox containing two buttons: UCButton1 and UCButton2.
What I want is to click UCButton1 and have MainFormLabel's text show "Button1", and MainFormLabel's text to show "Button2" when UCButton2 is clicked.
I can't get this to work -- I'm unable to reference MainFormLabel from the UC1.cs code. At best I get an "Object reference not set to an instance of an object" exception, despite using every conceivable variation of MainForm.ActiveForm... in the UC1.cs code.
What I want is to click UCButton1 and have MainFormLabel's text show "Button1", and MainFormLabel's text to show "Button2" when UCButton2 is clicked.
I can't get this to work -- I'm unable to reference MainFormLabel from the UC1.cs code. At best I get an "Object reference not set to an instance of an object" exception, despite using every conceivable variation of MainForm.ActiveForm... in the UC1.cs code.