Basit bir ajanda programı "
Önce veritabanı ve gerekli alanları oluşturuyoruz. Sonra forma Adodc, 8 adet textbox, 9 adet btn ve 8 adet label ekliyoruz. Btn isimlerini benim yazdığım gibi ayarlayın ve aşğıdaki kodları yapıştırın. yapmanız gereken bu kadar
Dim KayitSet As New ADODB.Recordset
Dim Baglan As New ADODB.Connection
Private Sub Veri()
On Error GoTo hata
Text1.Text = KayitSet![Ad]
Text2.Text = KayitSet![Soyad]
Text3.Text = KayitSet![Telefon]
Text4.Text = KayitSet![Faks]
Text5.Text = KayitSet![Cep]
Text6.Text = KayitSet![Mail]
Text7.Text = KayitSet![Adres]
Text8.Text = KayitSet![Not]
hata:
End Sub
Private Sub Oku()
Set KayitSet = New ADODB.Recordset
KayitSet.Open "Select * from Ajanda", Baglan, adOpenKeyset, adLockOptimistic
If KayitSet.RecordCount <> 0 Then
KayitSet.Fields.Refresh
Veri
End If
End Sub
Private Sub Bul_Click()
On Error GoTo hata:
res = InputBox("Kişi adını yaz")
If Trim(res) <> "" Then
res = "Ad='" + res + "'"
KayitSet.Find res
Text1.Text = KayitSet![Ad]
Text2.Text = KayitSet![Soyad]
Text3.Text = KayitSet![Telefon]
Text4.Text = KayitSet![Faks]
Text5.Text = KayitSet![Cep]
Text6.Text = KayitSet![Mail]
Text7.Text = KayitSet![Adres]
Text8.Text = KayitSet![Not]
End If
hata:
End Sub
Private Sub Kapat_Click()
Close All
End
End Sub
Private Sub Sil_Click()
If KayitSet.RecordCount <> 0 Then
KayitSet.Delete
KayitSet.Close
End If
Oku
End Sub
Private Sub Duzelt_Click()
If KayitSet.RecordCount <> 0 Then
KayitSet![Ad] = Text1.Text
KayitSet![Soyad] = Text2.Text
KayitSet![Telefon] = Text3.Text
KayitSet![Faks] = Text4.Text
KayitSet![Cep] = Text5.Text
KayitSet![Mail] = Text6.Text
KayitSet![Adres] = Text7.Text
KayitSet![Not] = Text8.Text
KayitSet.Update
KayitSet.Close
End If
Oku
End Sub
Private Sub Ekle_Click()
If Ekle.Caption = "Ekle" Then
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Ekle.Caption = "Kaydet"
Else
If KayitSet.RecordCount <> 0 Then
KayitSet.AddNew
KayitSet![Ad] = Text1.Text
KayitSet![Soyad] = Text2.Text
KayitSet![Telefon] = Text3.Text
KayitSet![Faks] = Text4.Text
KayitSet![Cep] = Text5.Text
KayitSet![Mail] = Text6.Text
KayitSet![Adres] = Text7.Text
KayitSet![Not] = Text8.Text
KayitSet.Update
KayitSet.Close
End If
Oku
Ekle.Caption = "Ekle"
End If
End Sub
Private Sub Form_Load()
Dim KayitSet As New Recordset
Set Baglan = New ADODB.Connection
Baglan.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path_ & "/ajanda.mdb"
Oku
End Sub
Private Sub İlkKayit_Click()
On Error GoTo hata
KayitSet.MoveFirst
Veri
hata:
End Sub
Private Sub Onceki_Click()
On Error GoTo hata:
KayitSet.MovePrevious
Veri
hata:
End Sub
Private Sub Son_Click()
On Error GoTo hata
KayitSet.MoveLast
Veri
hata:
End Sub
Private Sub Sonraki_Click()
On Error GoTo hata
KayitSet.MoveNext
Veri
hata:
End Sub



Alıntı ile Cevapla
Bu Konuyu Paylaşın !