Creating login form

So I am trying to make a program where before you can enter the actual Program itself it will take you to a second form where you first must login.

the code that i've essentially copy/pasted can be found here
http://www.programmersheaven.com/mb/bcbuilder/414824/414883/re-password-login-screen/?S=B20000

and it runs well... hides Form1 (the main program screen), brings up Form2, and if i enter the wrong password it even brings up the error message claiming so. but if i enter in the correct password (in my case i changed it to "asdf") it comes up with a "Access Violation at Address 52074D91 in module 'vcl100.bpl'. Read of Address 00000358."

I just can't seem to figure it out. I know that it's occuring when i get to the line "Form2->Close();". And if i simply try "Close();" it will shut down my entire application, not just the Login Form.

any ideas as to what i can change?
Form2 will close when it reaches the end of it's code. If you are trying to close a form that no longer exists (in otherwords destroy an object that was already destroyed) this is the type of error you would get, how about commenting out the close command and see what happens?
Last edited on
I commented out the close command and the form just sits there, does nothing basically.

However what i did do was i placed "Form1->Show();" instead of "Form2->Close()" for the button click to enter the password and that does seem to work, it will take me back to the original Form1 with my main program. The problem is though that it doesn't close Form2 now, it will just leave it where ever it was.

It appears that having "Form2->Close();" or "Form2->Hide();" will bring up those access violation errors and if i take it out then it wont close. And it appears that having them in the FormCreate for TForm1 doesn't effect them at all (guess that's because it's no longer creating the form, logical).

So how can i close Form2?
Topic archived. No new replies allowed.