Solved

Best practices for managing multiple vb.net winforms?

Posted on 2012-03-30
2
559 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

778 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