Event and delegate

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pranav23578
    New Member
    • Mar 2007
    • 1

    #1

    Event and delegate

    I am working on window based application.I am using 3 forms say Form1,2 and 3. When I click at some control of Form1 Form2 is opened and when I click at some control of Form2 ,Form3 is opened.StartUp form is Form1.On Form1 I am trying to set a property of Form3 and display it on a textbox of form3.Below is what I am doing:-
    namespace Form1.Forms
    {
    public delegate void ReferenceCellAd dressDelegate(s tring CellReference);

    public partial class frmLinkingStep : DI5_DAForm.DAFo rm
    {

    public event ReferenceCellAd dressDelegate SelectedCell;
    }
    private void CellSelectionCh anged(string cellAddress)
    {

    this.CellAddres s = cellAddress;
    this.SelectedCe ll(this.CellAdd ress); *****Run time error here****
    }

    basically i m trying to display cell address on form3 as
    //this code i wrote in form 3.
    public Form3()
    {
    InitializeCompo nent();

    SetEventHandler ();
    }
    private void SetEventHandler ()
    {
    LinkingStepForm = new frmLinkingStep( );
    this.LinkingSte pForm.SelectedC ell += new ReferenceCellAd dressDelegate(S electedCell);
    }

    I am getting a run time error as source code not avialable at current location and Selected cell value is null.What wrong i m doing.
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Write out the value of this.CellAddres s.

    Comment

    Working...