Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.pascal.delphi.misc > #641

Re: Undeclared identifier error getting.

From Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups comp.lang.pascal.delphi.misc
Subject Re: Undeclared identifier error getting.
Date 2014-09-30 16:31 +0200
Message-ID <c8vt99F5pnU1@mid.individual.net> (permalink)
References <49495c98-6639-46b0-9d55-48ea0e28404a@googlegroups.com> <c8vbrbFq1b7U1@mid.individual.net> <c87051c7-a577-46f7-b235-6d88ec921fae@googlegroups.com> <6f2cc906-3d00-4216-b732-e8d0e04fa298@googlegroups.com>

Show all headers | View raw


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

Back to comp.lang.pascal.delphi.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Undeclared identifier error getting. Sandeepan Kashyap <sandeepan1982@gmail.com> - 2014-09-30 00:15 -0700
  Re: Undeclared identifier error getting. JJ <jj4public@vfemail.net> - 2014-09-30 16:31 +0700
  Re: Undeclared identifier error getting. Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2014-09-30 11:23 +0200
    Re: Undeclared identifier error getting. Sandeepan Kashyap <sandeepan1982@gmail.com> - 2014-09-30 03:26 -0700
      Re: Undeclared identifier error getting. Sandeepan Kashyap <sandeepan1982@gmail.com> - 2014-09-30 04:23 -0700
        Re: Undeclared identifier error getting. Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2014-09-30 16:31 +0200
  Re: Undeclared identifier error getting. "Alan Lloyd" <alanglloyd@NotThisBitbtinternet.com> - 2014-10-05 19:26 +0100
    Re: Undeclared identifier error getting. Sandeepan Kashyap <sandeepan1982@gmail.com> - 2014-10-07 04:41 -0700

csiph-web