NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Displaying Dialog Boxes for Win Forms

You display a dialog box in the same way you display any other form in an application. The startup form loads automatically when the application is run. To make a second form or dialog box appear in the application, write code to load and display it. Similarly, to make the form or dialog box disappear, write code to unload or hide it.

To display a dialog box

  1. In your code editor, navigate to the event-handling method with which you want to open the dialog box. This can happen when a menu command is selected, when a button is clicked, or when any other event occurs.
  2. In the event-handling method, add code to open the dialog box. In this example, a Click event for a Button is used to show the dialog box:
    [Visual Basic]
    Private Sub Button1_Click()
       Dim dlg1 as new DialogBox
       dlg1.ShowDialog
    End Sub
    [C#]
    private void Button1_Click(object sender, EventArgs e) {
       MyDialogBox dlg1 = new MyDialogBox();
       dlg1.ShowDialog();
    }

    For more information on the ways to show forms and dialog boxes, see Displaying Modal and Modeless Forms.

See Also

Dialog Boxes | Creating Dialog Boxes | Closing Dialog Boxes and Retaining User Input | Retrieving the Result for Dialog Boxes | Retrieving Dialog Box Information Selectively Using Multiple Properties | Retrieving Dialog Box Information Collectively Using Objects | Retrieving Information from the Parent Form of a Dialog Box