Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Hans-Peter Diettrich Newsgroups: comp.lang.pascal.delphi.misc Subject: Re: Undeclared identifier error getting. Date: Tue, 30 Sep 2014 16:31:42 +0200 Lines: 26 Message-ID: References: <49495c98-6639-46b0-9d55-48ea0e28404a@googlegroups.com> <6f2cc906-3d00-4216-b732-e8d0e04fa298@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 2bSwAylc8ymDEtycAA7hiwsfeMOn9ZBIvTv8izr5F5A/QVZiA3 Cancel-Lock: sha1:+b8CEY5buiPYXNmf96LXQlencqA= User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) In-Reply-To: <6f2cc906-3d00-4216-b732-e8d0e04fa298@googlegroups.com> Xref: csiph.com comp.lang.pascal.delphi.misc:641 Sandeepan Kashyap schrieb: >>>> 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. > Ok, I tried below, past error has gone, but now I am getting error in Demographics form (main form): > [Error] Demographics.pas(50): This form of method call only allowed for class methods > Demographics form (main form): > > procedure TForm2.Button1Click(Sender: TObject); > begin > ShowMessage('tetss-'+ TSharedFunctions1.DoSomething()); //getting error This form of method call only allowed for class methods > end; You need an object before you can call one of its methods. E.g. add to your form class MyFuncs: TSharedFunctions; and create it in e.g. FormCreate: MyFuncs := TSharedFunctions1.Create; Then use that object to call e.g. MyFuncs.DoSomething(). Or you forget about TSharedFunctions1 and make DoSomething a simple function. DoDi