How to Logon to DB before main form starts

P

PetterL

I have a SQL DB program that I want the user to logon and then start the
main app.
The problem is when the login is OK and login form start the next window and
then close the login form, it also closes the mail form. I have also tried
to use the main startup class to control it from there but it ether just
flash the login window and main form and close or the order of windows is
wron if i lett bouth windows show before login. The main form over the login
box.

I think i doing something wrong and need a bit help to continue her.
I'm using VB 2005.
 
A

Armin Zingler

PetterL said:
I have a SQL DB program that I want the user to logon and then start
the main app.
The problem is when the login is OK and login form start the next
window and then close the login form, it also closes the mail form.
I have also tried to use the main startup class to control it from
there but it ether just flash the login window and main form and
close or the order of windows is wron if i lett bouth windows show
before login. The main form over the login box.

I think i doing something wrong and need a bit help to continue her.
I'm using VB 2005.

Probably the message loop, contained inside Application.Run, has not been
started. Possible solution:

class main
shared sub main

dim loginform as new loginform

if loginform.showdialog = dialogresult.ok _
andalso loginform.loginok then

application.run(new mainform)
end if
end sub
end class


I don't know how your loginform returns if the login was correct, therefore
the property 'loginok'. Set this sub main as the startup object in the
project's properties. You have to disable the application framework in order
to make this option available.


Armin
 
S

scorpion53061

I have a SQL DB program that I want the user to logon and then start the
main app.
The problem is when the login is OK and login form start the next window and
then close the login form, it also closes the mail form. I have also tried
to use the main startup class to control it from there but it ether just
flash the login window and main form and close or the order of windows is
wron if i lett bouth windows show before login. The main form over the login
box.

I think i doing something wrong and need a bit help to continue her.
I'm using VB 2005.

what you could do is declare an instance of the form, connection using
a function as a boolean. If it returns true, who the form, otherwise
dispose.
 

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