Loading a form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • juli jul

    Loading a form

    Hello,
    I created a form and excpected to see in a windows designer generated
    code something like this:
    this.Load += new System.EventHan dler(this.Form1 _Load);

    as I saw in other projects.
    But I don't see it and I need it in order to do things while the form
    loading.
    How can I add it and where it appears?
    Thank you!



    *** Sent via Developersdex http://www.developersdex.com ***
  • Morten Wennevik

    #2
    Re: Loading a form

    Hi juli,

    If you double click on the Form the designer will add a handler to the default event for that control as well as the method.

    You can also add it manually

    this.Load += new System.EventHan dler(this.Form1 _Load);

    private void Form1_Load(obje ct sender, EventArgs e)
    {
    // Add code here
    }

    Or, since you most likely are coding inside the Form1 class

    protected override void OnLoad(EventArg s e)
    {
    // Add code here, note no += EventHandler needed
    }


    On Mon, 09 May 2005 18:38:31 +0200, juli jul <juli8024@yahoo .com> wrote:
    [color=blue]
    > Hello,
    > I created a form and excpected to see in a windows designer generated
    > code something like this:
    > this.Load += new System.EventHan dler(this.Form1 _Load);
    >
    > as I saw in other projects.
    > But I don't see it and I need it in order to do things while the form
    > loading.
    > How can I add it and where it appears?
    > Thank you!
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    >[/color]



    --
    Happy coding!
    Morten Wennevik [C# MVP]

    Comment

    Working...