|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
newbie stupidity: opening one form and closing anotherI have two forms in my application, the main form (frmMain) and a details
form (frmEditDetails) I have a button on main to open the details form and close the main form. And the opposite in the details form. However instead of actually opening one and closing the other it just puts one over the top. Then when I go from main > details > main I have 3 forms open. Using the following code on the Main form: Dim Details As New frmEditDetails Details.Show() Dim Main As New frmMain Main.Close() Please someone tell me how I am going wrong. Thanks Instead of creating a new instance of your main form, create global
variables one for an instance of your main form and another one for an instance for your frmEditDetails form. This way you don't have multiple instances of each form. I'd use a module and use the Sub Main() subroutine to start up your program with something like: Dim Details as New frmEditDetails Dim Main as New frmMain Sub Main() Application.Start(Main) End Sub And then have two separate subroutines within your module and call them in the repective forms: Private Sub ShowDetails() Main.Hide() Details.Show() End Sub Private Sub ShowMain() Details.Hide() Main.Show() End Sub So then just call ShowMain when they click on the details form and ShowDetail when they click the button on the main form. Hope this helps
activeX doesn't dispose
Controlling MDI toolbars when child forms close ImageList issue unbounded array of objects gets error when instantiating elements detect mouse event on node of a treeview delete a record from datagrid How can I loop through all of the messages in the inbox - VB.NET E how to submit a form when enter is pressed Adding the same file to multiple projects. Array.Length vs Array.GetUpperBound(0) -- any real differences? |
|||||||||||||||||||||||