About
Contact
Disclaimer
Sitemap
coretanhans
Artikel dan Tips & Trick ada di website ini, selamat datang di coretanhans.com
Blogger
Food
Insurance
Lifestyle
Healthy
Technology
Error
More
Disclaimer
Sitemap
Theme
Tutorial
Home
Delphi 7
Perpustakaan
Aplikasi Perpustakaan - Edisi 3 (Form Menu Anggota)
Aplikasi Perpustakaan - Edisi 3 (Form Menu Anggota)
Hans
Agustus 06, 2019
Program Perpustakaan.
Tampilan Menu Utama
1. Membuat Form Anggota.
Buatlah sebuah Form untuk Anggota baru.
Apabila kalian sudah menambahkan form coba kalian masukan koding di bawah ini.
source code:
1: unit Unit8;
2:
3: interface
4:
5: uses
6: Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7: Dialogs, StdCtrls, Buttons, DB, ADODB, XPMan;
8:
9: type
10: TForm_DataAnggota = class(TForm)
11: GroupBox1: TGroupBox;
12: Label2: TLabel;
13: Label3: TLabel;
14: Label4: TLabel;
15: Label5: TLabel;
16: Label6: TLabel;
17: Label7: TLabel;
18: Label8: TLabel;
19: Label9: TLabel;
20: Label10: TLabel;
21: ListBox1: TListBox;
22: Edit1: TEdit;
23: Edit2: TEdit;
24: Edit3: TEdit;
25: Edit4: TEdit;
26: Edit5: TEdit;
27: Edit7: TEdit;
28: Edit8: TEdit;
29: Edit6: TEdit;
30: Memo1: TMemo;
31: XPManifest1: TXPManifest;
32: Query: TADOQuery;
33: BitBtn1: TBitBtn;
34: procedure FormActivate(Sender: TObject);
35: procedure ListBox1Click(Sender: TObject);
36: procedure BitBtn1Click(Sender: TObject);
37: procedure FormClose(Sender: TObject; var Action: TCloseAction);
38: private
39: { Private declarations }
40: public
41: { Public declarations }
42: end;
43:
44: var
45: Form_DataAnggota: TForm_DataAnggota;
46:
47: implementation
48:
49: uses unit2;
50:
51: {$R *.dfm}
52:
53: procedure TForm_DataAnggota.FormActivate(Sender: TObject);
54: begin
55: listbox1.Clear;
56: edit1.Clear;
57: edit2.Clear;
58: edit3.Clear;
59: edit4.Clear;
60: edit5.Clear;
61: edit6.Clear;
62: edit7.Clear;
63: edit8.Clear;
64: memo1.Clear;
65:
66: Query.Connection := Form_Utama.Koneksi;
67: Query.SQL.Add('select id_anggota from tabel_anggota;');
68: Query.Active := true;
69:
70: if Query.Eof then
71: MessageDlg('Kosong!',mtInformation,[mbOk],0);
72:
73: while not Query.Eof do
74: begin
75: Listbox1.Items.Add(Query['id_anggota']);
76: Query.Next;
77: end;
78:
79: Query.Active := false;
80: Query.SQL.Clear;
81: end;
82:
83: procedure TForm_DataAnggota.ListBox1Click(Sender: TObject);
84: var
85: i: integer;
86: begin
87: i := listbox1.ItemIndex;
88: if i < 0 then
89: exit;
90: Query.SQL.Add('select
nm_anggota,TTL,jns_kelamin,gol_darah,alamat,email,agama,status_pernikahan,pekerjaan from
tabel_anggota where id_anggota="' + listbox1.Items[i] + '";');
91: Query.Active := true;
92:
93: edit1.Text := Query['nm_anggota'];
94: edit2.Text := Query['TTL'];
95: edit3.Text := Query['jns_kelamin'];
96: edit4.Text := Query['gol_darah'];
97: memo1.Lines.Text := Query['alamat'];
98: edit5.Text := Query['email'];
99: edit6.Text := Query['agama'];
100: edit7.Text := Query['status_pernikahan'];
101: edit8.Text := Query['pekerjaan'];
102:
103: Query.Active := false;
104: Query.SQL.Clear;
105: end;
106:
107: procedure TForm_DataAnggota.BitBtn1Click(Sender: TObject);
108: begin
109: close;
110: end;
111:
112: procedure TForm_DataAnggota.FormClose(Sender: TObject;
113: var Action: TCloseAction);
114: begin
115: Form_Utama.Panel1.Show;
116: end;
117:
118: end.
Posting Lebih Baru
Posting Lama
Related Posts
Comments
Langganan:
Posting Komentar ( Atom )
Info Arlina
Comments