| |

VerySource

 Forgot password?
 Register
Search
View: 890|Reply: 8

The main form is displayed after login verification. How can I keep the login box from running in the background? ? ?

[Copy link]

3

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-3-6 21:30:01
| Show all posts |Read mode
I use vb.net to write a login verification box. When the login password is verified, the main form is entered, but the login box still works in the background. After I hide the login box, I cannot exit the program after closing the main form. Really quit the program after the form is closed! How do I end the login form after entering the main form? ? ?
Thank you in advance, ^ _ ^
Reply

Use magic Report

0

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-5-26 10:30:02
| Show all posts
You use the main form as the main form

Use the login form as a subform
Reply

Use magic Report

3

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-5-26 23:15:01
| Show all posts
But I want to start the login form first when starting the program. In this case, the login form is not a sub-form, what should I do?
Reply

Use magic Report

0

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-5-27 18:15:01
| Show all posts
In this case, first hide the login form.
When closing, make a judgment and close the hidden window to exit the program completely.
I used to do this the first time, but it was not convenient.

I suggest you replace it.
Reply

Use magic Report

0

Threads

21

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-5-28 02:15:01
| Show all posts
Write a login class with a login method with a return type of bool

public bool log () {
  bool flag = false;
  using (FormLogin f = new FormLogin ()) {
    if (f.ShowDialog () == DialogResult.OK)
    flag = true;
  }
  return flag;
}


Main method in the main program

[STAThread]
static void Main ()
{
Login login = new Login ();
if (login.log ())
Application.Run (new main window ());
}
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-6-4 20:30:01
| Show all posts
In the project properties-edit inside -> enable application framework -> program close mode -> when the last form is closed

Me.Hide()'I think this is a bit slow again
            Dim frm As New Form2
            frm.Show()
            Me.Close()
Reply

Use magic Report

2

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-6-5 11:30:01
| Show all posts
me.Hide();
Main mF = new Main();
mF.ShowDialog();
me.Close();
Reply

Use magic Report

3

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-6-7 13:15:01
| Show all posts
Thank you all friends upstairs, I did not expect to use ShowDialog, I use Show, blame had to do.
Thank you! ^_^
Reply

Use magic Report

0

Threads

21

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-6-13 17:45:01
| Show all posts
hide form is unwise choice
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list