Solved

Best practices for managing multiple vb.net winforms?

Posted on 2012-03-30
2
558 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
2 Comments
 
LVL 85

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now