Selasa, 22 Juni 2010
di
21.27
|
Uses Registry
Menyimpan Settingan Database
procedure TForm1.BBSimpanClick(Sender: TObject);
begin
try
// Membuat key baru
Reg.OpenKey(‘\Softwareku’, true);
// Menulis data string (Caption form) ke registry
Reg.WriteString(‘Host’, EHost.Text);
Reg.WriteString(‘Port’, EPortname.Text);
Reg.WriteString(‘User’, Euser.Text);
Reg.WriteString(‘Pass’, Epass.Text);
Reg.WriteString(‘Database’, EDBname.Text);
finally
Reg.CloseKey;
end;
end;
//ONCREATE FORM
procedure TForm1.FormCreate(Sender: TObject);
begin
Reg := Tregistry.Create;
Reg.RootKey := HKEY_CURRENT_USER;
end;
Memanggil Settingan database
try
try
Reg.OpenKey(‘\Softwareku’, false);
Edit1.Text := Reg.ReadString(‘Host’);
ComboBox1.Text := Reg.ReadString(‘Port’);
Edit2.Text := Reg.ReadString(‘User’);
Edit3.Text :=Reg.ReadString(‘Pass’);
Edit4.Text := Reg.ReadString(‘Database’);
except on ERegistryException do
ShowMessage(‘Gagal membaca settingan…’);
end;
finally
Reg.CloseKey;
End;
Menyimpan Settingan Database
procedure TForm1.BBSimpanClick(Sender: TObject);
begin
try
// Membuat key baru
Reg.OpenKey(‘\Softwareku’, true);
// Menulis data string (Caption form) ke registry
Reg.WriteString(‘Host’, EHost.Text);
Reg.WriteString(‘Port’, EPortname.Text);
Reg.WriteString(‘User’, Euser.Text);
Reg.WriteString(‘Pass’, Epass.Text);
Reg.WriteString(‘Database’, EDBname.Text);
finally
Reg.CloseKey;
end;
end;
//ONCREATE FORM
procedure TForm1.FormCreate(Sender: TObject);
begin
Reg := Tregistry.Create;
Reg.RootKey := HKEY_CURRENT_USER;
end;
Memanggil Settingan database
try
try
Reg.OpenKey(‘\Softwareku’, false);
Edit1.Text := Reg.ReadString(‘Host’);
ComboBox1.Text := Reg.ReadString(‘Port’);
Edit2.Text := Reg.ReadString(‘User’);
Edit3.Text :=Reg.ReadString(‘Pass’);
Edit4.Text := Reg.ReadString(‘Database’);
except on ERegistryException do
ShowMessage(‘Gagal membaca settingan…’);
end;
finally
Reg.CloseKey;
End;
Diposting oleh
Borland7
0 komentar:
Posting Komentar