Raised exception class EAccessViolation

Please discuss general Delphi programming topics here.

Raised exception class EAccessViolation

Postby misty29 » November 18th, 2015, 7:36 pm

I can't seem to find the cause of this. Please note I am still learning. Any help would be appreciated.

Project PAT_p.exe raised exception class EAccessViolation with message 'Access violation at address 0049E197 in module 'PAT_p.exe'. Read of address 00000000'. Process stopped. Use step or run to continue.



Code: Select all
unit Welcome_u;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, jpeg, ExtCtrls, Login_u;

type
  TWelcome = class(TForm)
    imgABC: TImage;
    btnBegin: TButton;
    lblWelcome: TLabel;
    procedure btnBeginClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Welcome: TWelcome;

implementation

{$R *.dfm}

procedure TWelcome.btnBeginClick(Sender: TObject);
begin
Welcome.Hide;
Login.ShowModal;
end;

end.




unit Login_u;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DMUsers, Game_u;

type
  TLogin = class(TForm)
    lblLogin: TLabel;
    lblUsername: TLabel;
    lblPassword: TLabel;
    edtUsername: TEdit;
    edtPassword: TEdit;
    btnLogin: TButton;
    lblRegister: TLabel;
    btnRegisterDirect: TButton;
    procedure btnRegisterDirectClick(Sender: TObject);
    procedure btnLoginClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Login: TLogin;

implementation

uses Register_u, ADODB;

{$R *.dfm}

procedure TLogin.btnRegisterDirectClick(Sender: TObject);
begin
Login.Hide;
Login.Close;
Register.ShowModal;
end;






procedure TLogin.btnLoginClick(Sender: TObject);
var
Result,PasswordResult:Boolean;
begin
Result := False;

begin
if edtPassword.GetTextLen=0 then
begin
ShowMessage('Please enter a password');
Game.ShowModal
end;

if edtUsername.GetTextLen=0 then
begin
ShowMessage('Please enter a password');
end;

Result:= DataModule1.tblUsers.Locate('UserName', edtUsername.Text,[]);
if Result=True then
begin
PasswordResult:=false;
PasswordResult:=DataModule1.tblUsers.Locate('Password', edtPassword.Text, []);
end;
if Result=false then
begin
ShowMessage('You are not registered');
end;
if Result=true then
begin
if PasswordResult=true then
begin
Login.Hide;
ShowMessage('Login successful');
Game.ShowModal;
end
else
begin
ShowMessage('Incorrect username or password');
end;
end;
end;
end;
end.





unit Game_u;

interface

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

type
  TGame = class(TForm)
    edtWord: TEdit;
    btnNext: TButton;
    imgTest: TImage;
    lblPicture: TLabel;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Game: TGame;

implementation

{$R *.dfm}

end.
misty29
Member
Member
 
Posts: 1
Joined: November 18th, 2015, 7:27 pm

Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 5 guests