Show form on top of all the others

T

Teo

Hi guys!
I am trying to display a login window that will ask the user to enter its
password before accessing the application.
I am wondering how I can do to display a form that will be on top of the
application and will stay locked until the user inputs the login, password
or aborts the use of the program by clicking the cancel button.
I have been trying to use the Topmost property but that doesn't seem to do
the trick.
Any suggestions?

Thanks much in advance,
Teo
 
B

Bill Voorhees

Just display the form using showdialog to make it modal. The user must
respond.
 
B

Bruce W. Roeser

Hi Teo,

Present your form with the ShowDialog method (rather than just Show) - the
form will then be presented modally and have exclusive focus in the
application.

-bwr-
 
K

kimiraikkonen

Hi guys!
I am trying to display a login window that will ask the user to enter its
password before accessing the application.
I am wondering how I can do to display a form that will be on top of the
application and will stay locked until the user inputs the login, password
or aborts the use of the program by clicking the cancel button.
I have been trying to use the Topmost property but that doesn't seem to do
the trick.
Any suggestions?

Thanks much in advance,
Teo

Besides above solutions, you may let your application show the main
program form after login form has granted access. The first form
should be login-required form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top