Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

user defined proceedures 1

Status
Not open for further replies.

yomyom

Programmer
Dec 23, 2002
119
GB
My user defined proceedures are not working in delphi4. I keep getting a compiler message saying undeclared forward. Infact, I don't know if I'm comming or going!!! Help you good people out there!!!
 
There are various ways to define procedures depending on the scope required. If you post your code (stripped down to the bare essentials), and a little more information as to what you are trying to do, your question may have an answer.
 
Dear Zathras,
here are snippets from my code. It is attempting to ensure no blank entries in a series of editboxes by calling my user defined 'Noblank' procedure.
.
.
.type
Tform1 = class(Tform)
.
.
.
procedure noBlank(sender:Tedit; var aMsg: String);
.
.
.
implementation
procedure noBlank(sender:Tedit; var aMsg:String);
var aString: String;
begin
if Sender = Edit2 then
MessageDlgBox(aString, mtInformation, [mbOk], 0,300,250);
sender.setfocus;
end;

.......
Try as I may, the compiler keeps flaging down my procedure with undeclared forward error.
Thanks 4 your help.
Yomyom.
 
You didn't show exactly where the first line that contains
Code:
procedure noBlank(sender:Tedit; var aMsg: String);
is located.

I assume it is something like this:
Code:
  TForm1 = class(TForm)
    procedure Button1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
Code:
    procedure noBlank(sender:Tedit; var aMsg: String);
Code:
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

It is part of TForm1 and needs to be qualified like this to use:
Code:
procedure
Code:
TForm1.
Code:
noBlank(sender:Tedit; var aMsg: String);
begin

end;

(Could be in either the public or the private section of the definition of TForm1.)

 
I will try your suggestion. I actually placed it just after the other proceedures defined by my project e.g
procedure FormCreate(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Edit2Exit(Sender: TObject);
procedure Edit3Exit(Sender: TObject);
procedure Edit4Exit(Sender: TObject);
procedure Edit5Exit(Sender: TObject);
procedure Edit6Exit(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure DBNavigator1Click(Sender: TObject; Button:
TNavigateBtn);
proceedure noBlank(........);
So now I'll try and place it in the private or public section.
Thanks. will let u know.
Yomyom.
 
Not sure if this is your problem or whether it's just a typo. Where you declare your noBlank procedure you have spelt procedure like this:

Code:
proceedure
Clive [infinity]

Don't forget what Christmas is all about: not [santa2] but Jesus!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top