Einzelnen Beitrag anzeigen

question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#1

access value by Property

  Alt 22. Aug 2013, 16:31
I have two procedures in a fine with different parameters, i want to access the parameter from one procedure to another

procedure TForm1.Person (ID : Integer);
//here ID=20

procedure TForm1.btnOkClick(Sender: TObject);

from btnOkClick, i want to call the Form1.Person (ID);

but since the ID is not listed as a parameter in TForm1.btnOkClick(Sender: TObject); therefore i cannot access the ID with appropriate value
how can i do that

i have tried with property such as
Pivate
FNewID: Integer;
procedure Person(ID:Integer);
public
property NewID: Integer readFNewID write FNewID;

and in the procedure TForm1.Person (ID : Integer);

i have did

procedure TForm1.Person (ID : Integer);
FNewID := ID
but unfortunaltely it gives the following relsut

ID = 20;
FNewID = 0;
but i expected
ID= 20;
FNewID = 20;
could you please explain me how to do that
  Mit Zitat antworten Zitat