Hi there,

I am currently having trouble with one thing. I am working on application which should work like this:

When I open it the login_form shows up, I insert login information and then it opens the main_form and gives it the login information and disappears.

The problem here is that if I run application with Application.Run(new Form2()); I cannot either Hide or get rid of the login window. And If I close the main_form application keeps running until I close the login_form.

I guess that whole concept I'm using is wrong so is there a waz to this< Thx in advance"

it could work this way

mainform.show()
this.close()

no, closing the login form would close the app.
This is a common issue and the general route is that the main form would open the login form, if login is successful the main form then loads all the things it needs, should it faill it then closes. (of course it doesnt have to be visible while the login form is shown)

Application.Exit(); will close the application but this.close(); will close the form but not the application

Now tell me which one is the 1st form when u execute ur applcation?, login or Main form

Allright, problem solved :D ... Thx LizR that was the right way... the prublem was that I tried to run application with Run(login_form).

in answer to traicey, the answer is the main form is the one that goes in the Run() parameters. Anything else dies when that dies.

Dont forget to mark the thread solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.