thaluska

access form from another form

Discussion created by thaluska on Oct 5, 2011
Hello
VB.net beginner here, a lot of my code was provided by friends, internet, etc.  I am working on an addin button for arcmap.  One of my friends advised that I could dim my initial form for my addin in the addin button onclick procedure in the button class so that if a user quit the addin and restarted it, they would get a fresh form each time they clicked the addin button:
    Protected Overrides Sub OnClick()
        Dim frmScenSet As New frmScenarioSettings(My.ArcMap.Application)
        frmScenSet.Show()
        SetWindowLong(frmScenSet.Handle.ToInt32, GWL_HWNDPARENT, m_app.hWnd)
        My.ArcMap.Application.CurrentTool = Nothing
    End Sub
At a point during operation of the addin, I want to hide this initial form and popup a second form so I hid my initial form with this command in a procedure in the frmScenSet class:
MyBase.hide()
After a user provides input to the second form, I want to hide the second form and show the initial frmScenSet form again.  Since the frmScenSet variable was dimmed inside the button onclick procedure, it is not accessible from the second form.  I can't use frmScenSet.show.  How would I show my initial form again? Any suggestions are welcome and vb.net code is much appreciated.
thanks
tlh

Outcomes