Imports System.Data.OleDbPublic Class Form1 Private bag As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=data.mdb") Private kmt As New OleDbCommand() Private adtr As New OleDbDataAdapter() Private dtst As New DataSet() Private dersadi As String() = New String(9) {} Private sinav_tarihi As String() = New String(9) {} Private r As Integer, g As Integer, b As Integer Private rs As New Random() 'Label[] labelDizi; Public Sub sinavlar() Dim tfark As TimeSpan Dim i As Integer = 0 Dim gunfark As String Try bag.Open() kmt.Connection = bag kmt.CommandText = "Select * from sinavbil" Dim oku As OleDbDataReader oku = kmt.ExecuteReader() While oku.Read() tfark = DateTime.Parse(DateTime.Now.ToLongDateString()) - DateTime.Parse(oku(1).ToString()) gunfark = tfark.TotalDays.ToString() If Integer.Parse(gunfark) = -1 Then dersadi(i) = oku(0).ToString() sinav_tarihi(i) = oku(1).ToString() If i = 0 Then label3.Visible = True label3.Text = (dersadi(i) & " ") + sinav_tarihi(i) End If If i = 1 Then label4.Visible = True label4.Text = (dersadi(i) & " ") + sinav_tarihi(i) End If If i = 2 Then label5.Visible = True label5.Text = (dersadi(i) & " ") + sinav_tarihi(i) End If If i = 3 Then label6.Visible = True label6.Text = (dersadi(i) & " ") + sinav_tarihi(i) End If i += 1 End If End While bag.Close() oku.Dispose() Catch End Try End Sub Private Sub Form1_Load_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load label4.Visible = False label5.Visible = False label6.Visible = False sinavlar() timer1.Enabled = True timer1.Interval = 100 End Sub Private Sub btnKaydet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKaydet.Click Try If textBox1.Text <> "" Then bag.Open() kmt.Connection = bag kmt.CommandText = ("INSERT INTO sinavbil(DersAdi,SinavTarihi) VALUES ('" & textBox1.Text & "','") + dateTimePicker1.Text & "') " kmt.ExecuteNonQuery() kmt.Dispose() bag.Close() textBox1.Clear() sinavlar() MessageBox.Show("Kayıt işlemi tamamlandı !") Else MessageBox.Show("Boş alanları doldurunuz !") End If Catch End Try End Sub Private Sub timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timer1.Tick r = rs.[Next](256) g = rs.[Next](256) b = rs.[Next](256) label3.ForeColor = Color.FromArgb(r, g, b) label4.ForeColor = Color.FromArgb(r, g, b) label5.ForeColor = Color.FromArgb(r, g, b) label6.ForeColor = Color.FromArgb(r, g, b) End Sub End Class