1. Hubungan Antara Combo Box dan Memo:
Procedure Tform1.ComboBox1Change(Sender:TObject);
Begin
Memo1.Lines.Clear;
Case Combobox1.ItemIndex of
0: Memo1.Lines.Add(Combobox1.Items[0]);
1: Memo1.Lines.Add(Combobox1.Items[1]);
2: Memo1.Lines.Add(Combobox1.Items[2]);
3: Memo1.Lines.Add(Combobox1.Items[3]);
4: Memo1.Lines.Add(Combobox1.Items[4]);
End;
End;
Procedure Tform1.Memo1Change(Sender:TObject);
Begin
If Combobox1.ItemIndex=0 then
Begin
Memo1.Color:=clblue;
Memo1.Font.Style:=[fsitalic];
Memo1.Font.Color:=clwhite;
End;
End;
2.Database Desktop
Navigator:
-Previous
Procedure Tfrmjurusan.btnPreviousClick(Sender:Tobject);
Begin
Tbjurusan.Prior;
End;
-Next
Tbjurusan.Next;
-Top
Tbjurusan.First;
-Bottom
Tbjurusan.Last;
FormCreate:
Begin
Ednim.text:=’ ‘;
Edjurusan.text:=’ ‘;
Ednim.enabled:=true;
DbComboJurusan:=false;
Edjurusan.enabled:=false;
Ednim.color:=clMenu;
DbComboJurusan.color:= clMenu;
Edjurusan.color:= clMenu;
End;
NIM KeyPress:
Var Ada:Boolean;
Begin
If not (key=chr(13)) then exit;
If length(ednim.text)<12 then exit;
Ada:=Tmahasiswa.FindKey([ednim.text]);
If Ada then
Begin
Beep;
Ednim.SetFocus;
Ednim.SelectAll;
Ednama.text:=Tmahasiswa[‘nama’];
DbComboJurusan.text:= Tmahasiswa[‘kodejurusan’];
//Pengembangan
Tjurusan.FindKey([DbComboJurusan.Text]);
Edjurusan.text:=Tjurusan[‘jurusan’];
Exit;
Ednama.SetFocus;
End;
End;
Simpan Click:
Begin
With Tmahsiswa do
Begin
Append;
FieldByName(‘NIM’).AsString:=edNIM.text;
FieldByName(‘Nama’).AsString:=ednama.text;
FieldByName(‘Kodejurusan’).AsString:=DbCombojurusan.text;
FieldByName(‘Jurusan’).AsString:=edjurusan.text;
Post;
End;
End;
DataBaruClick:
Begin
FormCreate(Sender);
edNIM.SetFocus;
End;
3.Relasi Database Engine ADO-Klik Objek ADOTable2 kemudian pilih properties MasterSource=DataSource1, MasterField (Joined Fields=KodeJurusan->KodeJurusan)
-Procedure Tform1.DBGridMahasiswaKeyPress(Sender:Tobject; Var Key:Char);
Begin
If Key=Chr(13) then
Edjumlah.text=IntToStr(ADOTable2.RecordCount);
End;
4.Data Module-Buat : Menu File -> New -> DataModule
-Masukkan komponen akses ke dalam DataModule