Simple Man
Member
- Joined
- Jul 7, 2010
- Messages
- 13
- Programming Experience
- 5-10
I've created a windows form application in vb 2010. I've got all my forms complete and now want to add a Login screen.
One the login screen, after the username/password is entered and OK is pressed, I try to open the a connection string. Obviously if the connection fails, the user has entered the incorrect credentials. If the credentials are ok, True is returned and I then open up the Main form that shows the correct items for the logged in user.
I'm having some issues when it comes to ending the application. In the properties of my application, the Startup form is Login. The shutdown mode is set to "When last form closes". After loging in successfully I open up the Main form and then close the Login form. From the Main form when a link is clicked to open up another form, I hide the Main form (frmMain.Hide) and then open up the next form (Form1). When Form1 is closed, I unhide frmMain by using frmMain.Show. If I try and close frmMain the VB is still in debug mode and I have to press the square. If I log into the program and the Main form opens up and then I close it, VB closes out of debug mode. Only if I open up a form from the Main form and close it, it's like it's opening up another frmMain but the other frmMain is still hidden. This make sense?
My thoughts to hide frmMain is so that I don't have to update the form based on the user that is logged in. I figured hiding it will be more efficient??? Maybe not. I haven't tried to close the form and reopen it yet. Just wondering if someone could explain my current issue.
Thanks.
Nick
One the login screen, after the username/password is entered and OK is pressed, I try to open the a connection string. Obviously if the connection fails, the user has entered the incorrect credentials. If the credentials are ok, True is returned and I then open up the Main form that shows the correct items for the logged in user.
I'm having some issues when it comes to ending the application. In the properties of my application, the Startup form is Login. The shutdown mode is set to "When last form closes". After loging in successfully I open up the Main form and then close the Login form. From the Main form when a link is clicked to open up another form, I hide the Main form (frmMain.Hide) and then open up the next form (Form1). When Form1 is closed, I unhide frmMain by using frmMain.Show. If I try and close frmMain the VB is still in debug mode and I have to press the square. If I log into the program and the Main form opens up and then I close it, VB closes out of debug mode. Only if I open up a form from the Main form and close it, it's like it's opening up another frmMain but the other frmMain is still hidden. This make sense?
My thoughts to hide frmMain is so that I don't have to update the form based on the user that is logged in. I figured hiding it will be more efficient??? Maybe not. I haven't tried to close the form and reopen it yet. Just wondering if someone could explain my current issue.
Thanks.
Nick