Einzelnen Beitrag anzeigen

Blup

Registriert seit: 7. Aug 2008
Ort: Brandenburg
1.464 Beiträge
 
Delphi 12 Athens
 
#12

AW: Access variable from one form to another

  Alt 21. Aug 2013, 14:21
The PersonID can alternatively be determined from a query:
Delphi-Quellcode:
unit unit1;

interface

type
  TForm1 = class(TForm)
    {...}
  private // <- for use self
    function GetMyPersonID: Integer;
    procedure SetMyPersonID(AValue: Integer);
  public // <- for use to other
    property MyPersonID: Integer read GetMyPersonID write SetPersonID;
  end;

var
  Form1: TForm1; // <- Instance of TForm1

implementation

procedure TForm1.SetMyPersonID(AValue: Integer);
begin
  FQuery.FieldByName('MyPersonID').AsInteger := AValue;
end;

procedure TForm1.GetMyPersonID: Integer;
begin
  Result := FQuery.FieldByName('MyPersonID').AsInteger;
end;
  Mit Zitat antworten Zitat