Jump to content

Closing main form without whole program.

- - - - -

  • Please log in to reply
7 replies to this topic

#1
xXAlphaXx

xXAlphaXx

    Learning Programmer

  • Members
  • PipPipPip
  • 85 posts
I am trying to close my programs login form after authenticating the user and pass, I have gotten it to open my new form and I have tried hiding the login form but that leaves the login thread running and I can imagine that will open some security vunerabilities after the login has validated the user.


Is their anyway to open this new form and kill the login thread without killing the whole program?

Me.Close() is closing the whole program so that is a problem. Any ideas?

#2
Xdawn90

Xdawn90

    Learning Programmer

  • Members
  • PipPipPip
  • 55 posts
How about changing the shutdown mode of the program ?

#3
xXAlphaXx

xXAlphaXx

    Learning Programmer

  • Members
  • PipPipPip
  • 85 posts
Changing the shutdown mode?

#4
TheCompBoy

TheCompBoy

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 272 posts
I think this might help you: Shutdown mode

Not sure tho, but its almost the same question as you asked here.
Think my post we're usefull? Please take your time and press the Like button at my post, Big Thanks!
For great C# & Android tutorials visit my blogg: http://www.thecompboy.com/

#5
Xdawn90

Xdawn90

    Learning Programmer

  • Members
  • PipPipPip
  • 55 posts
You can actually set the shutdown mode of the program in the project properties. Set your program to close when last form closes instead of the default - when startup form closes. Then you can call Me.Close() on your login form without closing the whole program.

#6
xXAlphaXx

xXAlphaXx

    Learning Programmer

  • Members
  • PipPipPip
  • 85 posts
PERFECT! Thanks much! It was the shutdown modes I needed to change.

#7
Abu Ehab

Abu Ehab

    Newbie

  • Members
  • PipPip
  • 11 posts
Try This :

mainForm.Close()
Or
MainForm.Hide()

#8
Blimp

Blimp

    Programmer

  • Members
  • PipPipPipPip
  • 154 posts
Doing the above methods do work, but I'd highly recommend to set it up in the project view, rather than in code view. Check under your project settings and there should be a combobox which has the text "Shutdown when startup form closes". Change that to "Shutdown when last form closes".

~ blimp.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users