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!

Retrieving Information from the Parent Form of a Dialog Box

Depending on what you need to do with your dialog box, you might want to have access to information provided by the dialog box's parent form. This information might be required for initialization of the dialog box, or involve specific details about the application state of the parent form.

To access public data from a parent form

  1. In your code editor, open the dialog box class.
  2. At the appropriate location within your code, use the ParentForm property of the dialog box to access the public members of the parent form.

    The following code demonstrates using the ParentForm property to access a method (in this example, GetMyParentFormData) on the parent form:

    [Visual Basic]
    Public Sub GetParentData()
       Dim x as String
       x = Me.ParentForm.GetMyParentFormData
    End Sub
    [C#]
    public void GetParentData(){
       string x = ((Form1)this.ParentForm).GetMyParentFormData();
    }

See Also

Dialog Boxes | ParentForm Property | Creating Dialog Boxes | Displaying Dialog Boxes for Win Forms | 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