listening to events causes null reference
From: Torbjorn Stavas (luser_at_skip.informatik.gu.se)
Date: 09/06/04
- Next message: Joshua T. Moore: "Re: stringformat"
- Previous message: Steve Maillet \(eMVP\): "Re: inter process communication ?"
- Next in thread: Sai: "Re: listening to events causes null reference"
- Reply: Sai: "Re: listening to events causes null reference"
- Reply: Duncan Mole: "Re: listening to events causes null reference"
- Messages sorted by: [ date ] [ thread ]
Date: 6 Sep 2004 09:56:06 -0700
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
- Next message: Joshua T. Moore: "Re: stringformat"
- Previous message: Steve Maillet \(eMVP\): "Re: inter process communication ?"
- Next in thread: Sai: "Re: listening to events causes null reference"
- Reply: Sai: "Re: listening to events causes null reference"
- Reply: Duncan Mole: "Re: listening to events causes null reference"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|