T
Torbjorn Stavas
I have a form with a few panels added to it. Each of these panels are
instances
of different classes, that has inherited System.Windows.Form.Panel,
such as
class Panel1 : System.Windows.Forms.Panel
class Panel2 : System.Windows.Forms.Panel
class Panel3 : System.Windows.Forms.Panel
Each of these panels are initiated in the main form, and added to the
form with Controls.add();
So, to the problem. In panel1, i want to listen to an event in panel2.
I'm solving this by having a reference (called frmRef) to the main
form in panel1.
In panel1, i try to listen to an event in panel2 with the help of the
following code:
(Code in Panel1)
this.frmRef.panel2.AnEvent += new AnEvent(pnl2_AnEvent);
this.line gives me a null reference when starting upp the program. I
tried to initiate panel2 in panel1, and adding it to panel1's control.
Then the listening to the event in panel2 works just fine. But this
isn't what i want to do.
What am i missing here?
//Torbjorn
instances
of different classes, that has inherited System.Windows.Form.Panel,
such as
class Panel1 : System.Windows.Forms.Panel
class Panel2 : System.Windows.Forms.Panel
class Panel3 : System.Windows.Forms.Panel
Each of these panels are initiated in the main form, and added to the
form with Controls.add();
So, to the problem. In panel1, i want to listen to an event in panel2.
I'm solving this by having a reference (called frmRef) to the main
form in panel1.
In panel1, i try to listen to an event in panel2 with the help of the
following code:
(Code in Panel1)
this.frmRef.panel2.AnEvent += new AnEvent(pnl2_AnEvent);
this.line gives me a null reference when starting upp the program. I
tried to initiate panel2 in panel1, and adding it to panel1's control.
Then the listening to the event in panel2 works just fine. But this
isn't what i want to do.
What am i missing here?
//Torbjorn