Solved

Best practices for managing multiple vb.net winforms?

Posted on 2012-03-30
2
565 Views
Last Modified: 2012-04-25
Hello experts, I created a windows applications with ms visual studio 2008.  I am looking for best practices for handling multiple windows forms.  In my case, the user will click a button that opens a new form, but he/she may need to navigate back to the original form.  In all there will be around 5 forms that a user may need to switch between.  I tried using the hide/show properties as well as creating new instances and using showdialog and me.close.  I dont want to create a new instance of the form when a user needs to go back.  I use the sub main procedure to launch the application


Imports System.Threading.Thread
Friend Class AppMgr

    <STAThread()> _
    Shared Sub Main()
   
        Dim frm_main As Loading_Form
        frm_main = New Loading_Form
        Application.Run(frm_main)

    End Sub
   
End Class
0
Comment
Question by:skyzipper
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 37787937
Why are you using sub main?  Set Loading_Form as the "Startup object" in Project --> Properties.

Now, whenever you open the forms, use the DEFAULT INSTANCE without the "New" keyword.

So, instead of this:

    Dim F1 As New Form1
    F1.Show()

You'd just use the NAME of the Form directly:

    Form1.Show()

Also, you can simple hide the current form, before opening another:

    Me.Hide()
    Form2.Show()

Depending on when you want the app close, you may want to change the "Shutdown mode" in Project --> Properties to "When last form closes".  By default, if you close the form set as the "Startup object" then the whole application closes.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 330 total points
ID: 37788089
I would suggest using MDI form with tabbed MDI manager which will make your application look like a tabbed browser like Chrome(functionally not visually).
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question