Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8782901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:41:14+00:00 2026-06-13T20:41:14+00:00

I have five forms in vb.net. 1. Welcome Form 2. Home Form 3. LogIn

  • 0

I have five forms in vb.net.

  1. Welcome Form
  2. Home Form
  3. LogIn Form
  4. Work1 Form
  5. Work2 Form

And one Enumeration:

  Public Enum OpenForm
      F_WORK1=1
      F_WORK2=2
  End Enum

And I declare all its object in Module:

  Public frmHome As Home
  Public frmLogin As LogIn
  Public frmWork1 As Work1
  Public frmWork2 As Work2

And then, when Welcome Form load:

 Me.Hide()
 frmHome = New Home
 frmHome.show()

And in Home Form, there are two buttons. And Home Form, I don’t close it. I keep open it until the application close.

  1. First button, use to open the Work1 Form. And when user click it, it will open LogIn Form and user must input username and password:

    frmLogin = New LogIn(OpenForm.F_WORK1)

    frmLogin.showDialog()

  2. Second button, use to open the Work2 Form. and when user click it, it will open LogIn Form and user must input username and password:

    frmLogin = new LogIn(OpenForm.F_WORK2)

    frmLogin.showDialog()

In LogIn Form, there is one button named btnLogin. And here is the LogIn Form code:

 Private frm As OpenForm 

 Public Sub New(f as OpenForm)
    InitailizeComponent()
    frm = f
 End Sub

And when user click btnLogin:

 If frm=OpenForm.F_WORK1 Then
    frmWork1 = New Work1()
    frmWork1.showDialog(frmHome)
    frmLogin.Close()
 ElseIf frm=OpenForm.F_WORK2 Then
    frmWork2 = New Work2()
    frmWork2.showDialog(frmHome)
    frmLogin.Close()
 End If

Then Work1 or Wor2 Form opened. But LogIn Form doesn’t close.


The problems:

  1. I want to close LogIn Form and open Work1 or Work2 Form after user click btnLogin.
  2. And when user minimize the Work1 or Work2 Form, I want the Home Form also minimize. And when user mouse move the taskbar, I want it preview which Form that I opened.
  3. Each Form(Home Form, Work1 Form and Work2 Form) contain a lot of control that make my user interface very slow and not smooth. So I want it loads its contain first and then visible the Form.

Thank for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:41:16+00:00Added an answer on June 13, 2026 at 8:41 pm

    Your Home Form knows what is the right form to open after the login is successuful.
    Let it decide which form to Open

    in the first button

    frmLogin = New LogIn()
    if DialogResult.OK = frmLogin.showDialog() then
        frmWork1 = New Work1()
        frmWork1.showDialog(frmHome)
    end if
    

    in the second button

    frmLogin = New LogIn()
    if DialogResult.OK = frmLogin.showDialog() then
        frmWork2 = New Work2()
        frmWork2.showDialog(frmHome)
    end if
    

    Your actual code doesn’t work because ShowDialog stops the execution of the subsequent code till the form opened by the ShowDialog close. It is called a Modal Form.

    Forget to say to set the DialogResult property of the btnLogin to DialogResult.OK.
    This will tell to the framework to automatically close your Login form when the user press that button.
    Instead, if the validation of the user fails, set the frmLogin.DialogResult property to DialogResult.None to block the automatic form closing.

    For the second question, it should already work in this way. When you call ShowDialog method and pass the owner form, the the two forms are binded togheter and minimizing the fmrWork1/2 should also minimize the frmHome. The visualization in the Taskbar is automatic unless you have set the form ShowInTaskbar property to false.

    The third question is difficult to answer. A possible solution is to divide your input control in tab pages using the tab control. Each page should contain a user control with the appropriate inputs for that page. Every page but the first will be leaved empty and only when the user changes the selected page you load the corresponding user control. As you can see this is a very complex topic that cannot fully explained without a bit of research on your side.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have five buttons on one form that when clicked enables a bool each
i have five forms in my c# project. one host an httplistener that i
I have a formset that contains five forms. Each form is simply a file
i have multiple search forms, for five different databases (tables) each form contains about
We have a form with five <input type=file/> elements that is in production and
I have a DLL with one single function That gets five doubles and one
I have a form where five fields are there but when i click on
I have five $_POST hidden fields in my form that hold the id's names
I have five combo boxes. Each one has a different name, but the possible
I have an application containing a form with five input fields. When the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.