Arsip: Deklarasi Global di delphi 8

 
user image
more 15 years ago

rusli_chow

Rekan delphier, gimana ya mendeklarasikan suatu variabel tapi variabel tersebut dapat dipakai utk semua form dalam satu project ? Saya deklarasikan di bawah implementation tapi yang bisa pakai variabel ini cuma dalam 1 form. seperti ini ; unit WinForm; interface uses System.Drawing, System.Collections, System.ComponentModel, System.Windows.Forms, System.Data; type TWinForm = class(System.Windows.Forms.Form) {$REGION 'Designer Managed Code'} strict private /// <summary> /// Required designer variable. /// </summary> Components: System.ComponentModel.Container; /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> procedure InitializeComponent; procedure TWinForm_Load(sender: System.Object; e: System.EventArgs); {$ENDREGION} strict protected /// <summary> /// Clean up any resources being used. /// </summary> procedure Dispose(Disposing: Boolean); override; private { Private Declarations } public constructor Create; end; [assembly: RuntimeRequiredAttribute(TypeOf(TWinForm))] implementation //saya deklarasikan disini var a : string;
user image
more 15 years ago

mas_kofa

deklarasikan di atas implementasi........
user image
more 15 years ago

herux

buat property atau taruh variable di section public
user image
more 15 years ago

pebbie

global var di bagian interface bisa diakses oleh semua unit lain yang menginklusi unit tsb. global var di bagian implementation hanya bisa diakses oleh modul tsb (global thd kode prosedur/class method di lingkup implementation itu saja).
more ...
  • Pages:
  • 1
Share to

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com