Solved

Best practices for managing multiple vb.net winforms?

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

724 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