Sandeepan Kashyap
2014-09-30 07:15:08 UTC
Hi,
we are trying to access a function DoSomething() of unit stringcheck from unit Demographics . While running, we are getting 'Undeclared identifier: 'TSharedFunctions1' error, not sure why? though we have used the unit in main Unit.
Any ideas will be greatly appreciated.
unit stringcheck;
interface
implementation
{$R *.RES}
uses sysutils ,StrUtils;
type
TSharedFunctions1 = class
public
function DoSomething: string;
end;
function TSharedFunctions1.DoSomething: string;
begin
Result := 'Something done';
end;
end.
*************************************************************************
Main Unit (Demographics;)
unit Demographics;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Final, stringcheck; //uses stringcheck.pas
type
TForm2 = class(TForm)
Name: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FinalVal(Sender: TObject);
private
{ Private declarations }
public
SharedData: TForm1;
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.FinalVal(Sender: TObject);
begin
ShowMessage('tetss'+ IntToStr(Form1.Test1));
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
ShowMessage('tetss print-'+ TSharedFunctions1.DoSomething()); //Undeclared identifier: 'TSharedFunctions1'
end;
Thanks
Sandeepan.
we are trying to access a function DoSomething() of unit stringcheck from unit Demographics . While running, we are getting 'Undeclared identifier: 'TSharedFunctions1' error, not sure why? though we have used the unit in main Unit.
Any ideas will be greatly appreciated.
unit stringcheck;
interface
implementation
{$R *.RES}
uses sysutils ,StrUtils;
type
TSharedFunctions1 = class
public
function DoSomething: string;
end;
function TSharedFunctions1.DoSomething: string;
begin
Result := 'Something done';
end;
end.
*************************************************************************
Main Unit (Demographics;)
unit Demographics;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Final, stringcheck; //uses stringcheck.pas
type
TForm2 = class(TForm)
Name: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FinalVal(Sender: TObject);
private
{ Private declarations }
public
SharedData: TForm1;
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.FinalVal(Sender: TObject);
begin
ShowMessage('tetss'+ IntToStr(Form1.Test1));
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
ShowMessage('tetss print-'+ TSharedFunctions1.DoSomething()); //Undeclared identifier: 'TSharedFunctions1'
end;
Thanks
Sandeepan.