Perancangan/Design pada form dari ToolBox di atas sebagai berikut:
Perancangan banyak kolom pada DataGridView perhatikan gambar dibawah ini:
Jika memilih Edit Columns akan tampil kotak dialog seperti gambar di bawah ini:
Hasil perancangan Form seperti gambar dibawah ini:
Source/ listing program sebagai berikut:
Option Explicit On
PublicClass Form1
Dim t AsInteger
Dim count AsInteger
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button5.Enabled = True
REM Inisialisasi data counter
count = 0
DataGridView1.Rows.Clear()
DataGridView1.Rows.GetNextRow(count, DataGridViewElementStates.ReadOnly)
REM Aktifkan data counter agar dapat ditampilkan
REM ke tabel DataGridView1
Timer1.Enabled = True
Timer2.Enabled = True
EndSub
PrivateSub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
REM Menampilkan data diatur dengan timer
DimAsInteger
b = CInt(TextBox1.Text)
DataGridView1.Rows.Add()
DataGridView1.Rows.GetNextRow(count, DataGridViewElementStates.ReadOnly)
DataGridView1.Item(0, b - 1).Value = count
DataGridView1.Item(1, b - 1).Value = Now
DataGridView1.Item(2, b - 1).Value = 5
DataGridView1.Item(3, b - 1).Value = 1
DataGridView1.Item(4, b - 1).Value = count
EndSub
PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
REM Menghapus display data pada dataGridView1
Button5.Enabled = False
Timer1.Enabled = False
Timer2.Enabled = False
DataGridView1.Rows.Clear()
DataGridView1.Rows.GetNextRow(1, DataGridViewElementStates.ReadOnly) EndSub
PrivateSub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
REM untuk counter banyak data
REM atau menentukan banyak baris pada tabel datagridView1
If Timer2.Enabled = TrueThen
count = count + 1
TextBox1.Text = count
Else
count = Val(TextBox1.Text) + count
count = count + 1
TextBox1.Text = count
EndIf
EndSub
PrivateSub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
REM Stop data Counter
Timer1.Enabled = False
Timer2.Enabled = False
EndSub
PrivateSub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
End
EndSub
PrivateSub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
REM jika nilai count lebih besar pada textbox1 lebih besar dari 0
REM lanjutkan count pada angka yang ditunjukkan pada text box
If TextBox1.Text > 0 Then
count = TextBox1.Text
Timer1.Enabled = True
Timer2.Enabled = True
EndIf
EndSub
EndClass
Selamat mencoba Guys! Nantikan Tips Aplikasi Cantik Lainnya by Verynandus Hutabalian
0 komentar:
Posting Komentar