Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6361117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:44:05+00:00 2026-05-24T23:44:05+00:00

Please help me with the following code. I get a Access violation from delphi

  • 0

Please help me with the following code. I get a Access violation from delphi once I click the Log IN button…. Indicated by the !!!

LogIn Unit

unit Log;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls,cls_LogIn,Jpeg;

type
  TForm2 = class(TForm)
    lbllogIn: TLabel;
    pnlSplitter: TPanel;
    edtUserName: TEdit;
    edtPassword: TEdit;
    lblUserName: TLabel;
    lblPassword: TLabel;
    btnLogIn: TButton;
    btnRegister: TButton;
    lblRegister: TLabel;
    edtRegName: TEdit;
    edtRegSurname: TEdit;
    edtRegPassword: TEdit;
    edtCountry: TEdit;
    edtHomelanguage: TEdit;
    btnRegisterF: TButton;
    btnCancel: TButton;
    lblRegName: TLabel;
    lblRegSurname: TLabel;
    lblRegPassword: TLabel;
    lblCountry: TLabel;
    lblHomelanguage: TLabel;
    imgLinks: TImage;
    imgRegs: TImage;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure btnLogInClick(Sender: TObject);
  private

  public

    { Public declarations }
  end;

var
  Form2: TForm2;
  Login : Tlogin;
implementation

uses Main;

{$R *.dfm}

procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Application.Terminate;

end;

procedure TForm2.btnLogInClick(Sender: TObject);   **!!!!!!!!**
var

bUser,bPassword : Boolean;
sUser,sPassword,sMessage : string;
begin
  form1.qrymain.close  ;
Form1.Qrymain.sql.text := 'select * from Gebruikers';
form1.qryMain.open;

sUser := edtUserName.Text;
sPassword := edtpassword.text;
bUser :=  form1.qrymain.locate('Username',sUser,[]);
bPassword := form1.qrymain.locate('Password',sPassword,[]);
Login.create;
login.create(sUser,sPassword,bUser,bPassword);
sMessage:= Login.toetslog;
ShowMessage(sMessage);

end;

Class Unit:

unit cls_LogIn;

interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, StdCtrls, Buttons, math, ExtCtrls;
type
Tlogin = class(Tobject)

private

Fepos :string ;
fwagwoord :string ;
Fbepos : Boolean;
fbwagwoord : Boolean;
public
constructor create; overload;
constructor Create(epos,wagwoord:String;bepos, bwagwoord: boolean); overload; 

function toetslog: string;


end;
implementation

{ Tlogin }



constructor Tlogin.Create(epos, wagwoord: String;bepos, bwagwoord: boolean);
begin
fepos := epos ;
fwagwoord := wagwoord ;
fbepos := bepos;
fbwagwoord := bwagwoord;
end;


constructor Tlogin.create;
begin
 fepos:= ' ';
 fwagwoord := ' ';
 fbepos := false;
 fbwagwoord := true;
end;

function Tlogin.toetslog;
begin

if (fbepos = True) and (fbwagwoord = True)
then
begin
result := 'Welcome '+' '+fepos
 end
else
result := 'SORRY VERKEERD HEHE'+' '+fwagwoord ;
end;


end.
end.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:44:06+00:00Added an answer on May 24, 2026 at 11:44 pm

    Skip login.create and correct next line to :

    login := TLogin.Create(sUser,sPassword,bUser,bPassword);
    

    the login object should be freed when the login is ready as well.

    Like this :

    login := TLogin.Create(sUser,sPassword,bUser,bPassword);
    try
      sMessage := login.toetslog;
      ShowMessage(sMessage);
    finally
      login.free;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am newbie on the Linux signals, please help. The following code get core
Please can someone help? I have the following code which uploads a file to
Please would someone who understands VBA Arrays (Access 2003) help me with the following
I've written following code to get the content from a web page and save
Please help regarding the following issue. I have enabled the Block popup option in
Please help I am getting the following error when I am binding the drop
Please help me out with an algorithm for the following problem - Given a
Please help! I couldn't figure it out how to map the following situation: I
Can anyone please help me to work out how to achieve the following? I
Can someone please help me figure out a way to achieve the following (see

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.