Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Visual Basic Net - Waiting for form to finish?

  • 03-06-2004 10: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, Registered Users 2 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