0% found this document useful (0 votes)
40 views4 pages

Visual Basic Form Setup Guide

The document provides code for a multi-dimensional array application in Visual Basic. It includes code to: 1. Create a multi-dimensional array to store student data and populate form controls like listviews and comboboxes from the array values. 2. Add a new student's data to the listview when a process button is clicked by getting values from textboxes and comboboxes. 3. Include code to close the form and update labels with the current date, 12-hour time and 24-hour time when a timer tick event occurs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views4 pages

Visual Basic Form Setup Guide

The document provides code for a multi-dimensional array application in Visual Basic. It includes code to: 1. Create a multi-dimensional array to store student data and populate form controls like listviews and comboboxes from the array values. 2. Add a new student's data to the listview when a process button is clicked by getting values from textboxes and comboboxes. 3. Include code to close the form and update labels with the current date, 12-hour time and 24-hour time when a timer tick event occurs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Array

1. Buatlah tampilan sebagai berikut:

2. Ubahlah Properti seperti tampilan berikut:


No Objek Property Nilai Properti
1 Form1 Text Array Multi Dimensi
2 Label1 Text NIS
3 Label2 Text NAMA
4 Label3 Text JURUSAN
5 Label4 Text KELAS
6 Label5 Name Lbl12Jam
7 Label6 Name Lbl24Jam
8 Timer1 Enable True
Interval 100
9 Textbox1 Name TxtNIS
10 Textbox2 Name TxtNama
11 ComboBox1 Name Cmbjurusan
12 ComboBox2 Name Cmbkelas
13 Button1 Name BtnProses
Text Proses
Flatstyle Standard
14 Button2 Name BtnExit
Text Exit
Flatstyle Standard
15 ListView1 Name ListView1

Buatlah Kode Program Tiap event,


Sebagai Berikut :

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
Dim Arr(3, 1) As String
Arr(0, 0) = "NIS"
Arr(0, 1) = "NAMA"
Arr(1, 0) = "JURUSAN"
Arr(1, 1) = "KELAS"
Arr(2, 0) = "TKJ"
Arr(2, 1) = "TGB"
Arr(3, 0) = "XI TKJ 1"
Arr(3, 1) = "XI TKJ 2"

ListView1.GridLines = True
ListView1.View = View.Details

For Baris = 0 To 1
For Kolom = 0 To 1
ListView1.Columns.Add(Arr(Baris, Kolom), 100)
Next Kolom
Next Baris

For Baris = 2 To 2
For Kolom = 0 To 1
Cmbjurusan.Items.Add(Arr(Baris, Kolom))
Next Kolom
Next Baris

For Baris = 3 To 3
For Kolom = 0 To 1
Cmbkelas.Items.Add(Arr(Baris, Kolom))
Next Kolom
Next Baris
End Sub

Private Sub BtnProses_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BtnProses.Click
Dim Arr(3) As String
Arr(0) = TxtNIS.Text
Arr(1) = TxtNama.Text
Arr(2) = Cmbjurusan.Text
Arr(3) = Cmbkelas.Text

Dim listitem As ListViewItem


listitem = New ListViewItem
listitem = ListView1.Items.Add(Arr(0))
listitem.SubItems.Add(Arr(1))
listitem.SubItems.Add(Arr(2))
listitem.SubItems.Add(Arr(3))
TxtNIS.Text = ""
TxtNama.Text = ""
Cmbjurusan.Text = ""
Cmbkelas.Text = ""
TxtNama.Focus()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BtnExit.Click
Me.Close()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer1.Tick
Lbl12Jam.Text = Format(Now, "hh:mm:ss tt")
Lbl24Jam.Text = Format(Now, "H:mm:ss")
LblTanggal.Text = Format(Now, "dddd, dd – MMMM – yyyy")
End Sub

End Class
HASIL:

You might also like