AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Access variable from one form to another
Thema durchsuchen
Ansicht
Themen-Optionen

Access variable from one form to another

Ein Thema von question · begonnen am 20. Aug 2013 · letzter Beitrag vom 26. Aug 2013
 
Blup

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

AW: Access variable from one form to another

  Alt 21. Aug 2013, 08:33
The solution has already been posted, again in detail:
Delphi-Quellcode:
unit unit1;

interface

type
  TForm1 = class(TForm)
    {...}
  private // <- for use self
    FMyPersonID: Integer;
    procedure Person1(ID:Integer);
  public // <- for use to other
    property MyPersonID: Integer read FMyPersonID write FMyPersonID;
  end;

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

implementation

Procedure TForm1.Person1(ID:Integer);<--- i want to use this value of ID in another Form
begin
  FMyPersonID := ID;
end;



unit unit2;

interface

type
  TForm2 = class(TForm)
    {...}
    procedure Button1Click(Sender: TObject);
  end;

implementation

uses
  unit1; // <- knowhow about TForm1, MyPersonID and Form1

Procedure TForm2.Button1Click(Sender: TObject);
begin
//here i want to use the value of ID from TForm1
  Form1.MyPersonID := Form1.MyPersonID + 1;

end;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:39 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz