Jump to content
karlxnaizu

Program terminates Automatically

Recommended Posts

Hello, I'm new to this framework, and as a student, I've been assigned the task of creating a login/registration form. Initially, everything was working well, from registering an account to logging in. However, I encountered an issue when I opened it from my main page, which has two buttons: one for login and one for registration. Whenever I click either of these buttons and then click anywhere on the newly opened form, the program abruptly terminates. I'm wondering if this problem is due to a software issue.

Share this post


Link to post

@karlxnaizu  at first, always show your "code" to analise, ok?

 

maybe, your problem can be a "object not created yet", or be, you are trying show a form or any other object that was not created like this:

Quote

var

   myForm:TFormXXX;

begin

   MyForm.SHOW or SHOWModal;  <-- but the object was not created yet!!!!   needs:  MyForm := TFormXXX.Create(  nil or application or any other owner here );

then, It should be:

Quote

var

   myForm:TFormXXX;

begin

   MyForm := TFormXXX.Create( nil );

   try

      MyForm.ShowModal;

   finally

      FreeAndNil(MyForm);  // or MyForm.Free or MyForm.DisposeOf;

  end;

now, look at your "Form created" on event OnClick, for example, or any other event used  to see any problem... 

 

NOTE: use a "BreakPoint" on the line that you need "stop" and see whats happens... F5 = breakpoint,  F8 = continue next line on debug, F9 = continue running in debug... etc...

Edited by programmerdelphi2k

Share this post


Link to post

Hello I appreciate the help, This is my .cpp file codes. 
I have 4 of them.
mainForm.cpp
loginForm.cpp
registrationForm.cpp
Unit1.cpp 

This code actually works at first. the solution I do last time was to make another project and rewrite the code. I don't want to do this forever.

code.txt

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×