CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2006
    Posts
    8

    Red face Switching from one form to another on event

    So, I click on a button or whatever and another form takes the place of current one like in an installation wizard for instance....
    Also how could I pass the data from one form to another upon the same event?

  2. #2
    Join Date
    Apr 2006
    Posts
    17

    Re: Switching from one form to another on event

    let's say you want to pass a string from form 1 to form 2

    so , in your button click event handler in form1 add something like this

    form2 f2 = new form2(string stringiWantToPass);

    f2.showDialog();





    so just make yourself a custom constructor for making form2, you can also pass your form1 instance to form2.

    form2 f2 = new form2 (this);

    your constructor in form2 should look like this:

    public form2(System.Windows.Forms form)
    {
    ...
    }


    there will be also other ways of doing this

  3. #3
    Join Date
    Mar 2006
    Posts
    8

    Re: Switching from one form to another on event

    Hope this one will do. Thanx.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured