S10n

Hi, I have another problem with the login form, I have my login form which is the main form of my project, when the user types in the password and the username in the login form, this data is passed to the other form (the one that loads the data) using the constructor, then this form builds the connection string for the oracle connection and tries to open the connection, however if the password is not correct and I get an error from the oracle client I need to show the login form again. Could somebody help me on how to make the login form again. by the way, the login form is never closed, I just hide on the login button login click event.


Re: Windows Forms General call instance of main form

boban.s

Create a property in the main form Connected which will be set to true or false in the form constructor depending on connection success. When calling main form from Login form, after instancing main form, contstructor is executed and after that line you can check the Connected property. If it's false, show the login form, and instead of executing show method of main form, set instance of main form to null.

Also and by me better way of doing this is to call login form in Load event of Main form, and main form to be really main form. That way you can call login form in a loop until user login successfully or it cancel loggin operation.