unhandled exception blues...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Greg Merideth

    unhandled exception blues...

    I have a class (Class A) that displays a form built from
    scratch with data from xml files. (Class A) creates an
    array of LinkLabel's that are created and "added" to by
    the LinkLabelArray' s class methods (Class B).

    When the user selected a link, the clickhandler was in
    (Class B) where the link arrays methods are, and the
    screen stayed up for the user to close.

    So, in the loop in (Class A) I added:

    this.arrayLinkC ontrol[storyNode].Click += new
    System.EventHan dler(LinkLabelC lickHandler);

    LinkLabelClickH andler exists as a method in (Class A).

    Now, this works just fine and dandy however..when you
    click on the link, the method does this:

    private void LinkLabelClickH andler(
    Object sender, System.EventArg s e)
    {
    string strVisitUrl =
    ((System.Window s.Forms.LinkLab el)sender).Text .Trim();
    System.Diagnost ics.Process.Sta rt(strVisitUrl) ;
    this.Close();
    }

    Which *does* fire up IE and brings the user to the page
    but then I get:

    An unhandled exception of
    type 'System.ObjectD isopsedExceptio n' occured
    Cannot access a disposed object named "LinkLabel"

    What am I doing majorly wrong here? I got fed up and
    threw a try{} with an empty catch{} around it but I would
    think I'm only asking for major trouble then.

Working...