Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Visual Basic Net - Waiting for form to finish?

Options
  • 03-06-2004 11:26am
    #1
    Closed Accounts Posts: 599 ✭✭✭


    Hi,

    I want to call multiple forms one after the other.
    But i want them to show up when the last one is finsihed.
    I am calling them from a seperate module, which has:

    dim Frm1 As New Form_Task1
    dim Frm2 As New Form_Task2
    dim Frm3 As New Form_Task3


    Frm1.ShowDialog() ' would like to show this form and wait for the user to select a button
    Frm2.ShowDialog()' Show this when the previous form has finished...

    Do i need to setup a return value and set variable = Frm1.ShowDialog ?

    Can someone show me how this is done?

    cheers,

    toil


Comments

  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    .ShowDialog() returns a DialogResult enum.

    If you have an OK and Cancel button on Form_Task1 then set the DialogResult property for those buttons in the properties window.

    When the user clicks OK on Form_Task1 that instance of the form will return DialogResult.OK (taken that the OK button is set to return that value).

    So if instance frm1's ShowDialog() method returns DialogResult.OK you can move onto showing frm2 and so on into frm3.

    Hope this helps.

    <edit/> Actually I should post some code to illustrate this, its C# (dunno Vb.net).
    if(frm1.ShowDialog(this)==DialogResult.OK)
    {
        // Now show dialog 2
    
        ....
    }
    


Advertisement