Latihan 1 Array Multidimensi
Berikut Source Codenya :
Public Class latihan4
'nadiahtami 2017230007'
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim arr(4) As String
arr(0) = TextBox1.Text
arr(1) = TextBox2.Text
arr(2) = ComboBox1.Text
arr(3) = ComboBox2.Text
Dim list As New ListViewItem
list = ListView1.Items.Add(arr(0))
list.SubItems.Add(arr(1))
list.SubItems.Add(arr(2))
list.SubItems.Add(arr(3))
TextBox1.Text = TextBox1.Text + 1
TextBox2.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
TextBox2.Focus()
End Sub
Private Sub latihan4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim arr(3, 1) As String
arr(0, 0) = "NIM"
arr(0, 1) = "Nama"
arr(1, 0) = "Jenis Kelamin"
arr(1, 1) = "Status"
arr(2, 0) = "Laki-laki"
arr(2, 1) = "Perempuan"
arr(3, 0) = "Menikah"
arr(3, 1) = "Belum Menikah"
'MENAMPILKAN GRID/GARIS TABEL UNTUK LISTVIEW'
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
Next
For baris = 2 To 2
For kolom = 0 To 1
ComboBox1.Items.Add(arr(baris, kolom))
Next
Next
For baris = 3 To 3
For kolom = 0 To 1
ComboBox2.Items.Add(arr(baris, kolom))
Next
Next
TextBox1.ReadOnly = True
TextBox1.Text = "1"
TextBox2.Focus()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim pesan As String
pesan = MsgBox("Yakin ingin keluar?", vbYesNo, "Konfirmasi")
If pesan = vbYes Then
End
End If
End Sub
End Class
Latihan 2 Array Multidimensi
Berikut Source Codenya :
Public Class latihan5
'nadiahtami 2017230007'
Private Sub latihan5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim arr(4, 1) As String
arr(0, 0) = "ID"
arr(0, 1) = "Nama"
arr(1, 0) = "Jenis Kelamin"
arr(1, 1) = "Jabatan"
arr(2, 0) = "Alamat"
arr(2, 1) = "Tempat, Tanggal Lahir"
arr(3, 0) = "Telp/Hp"
arr(3, 1) = "Email"
arr(4, 0) = "Laki-Laki"
arr(4, 1) = "Perempuan"
'MENAMPILKAN GRID/GARIS TABEL UNTUK LISTVIEW'
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 = 4 To 4
For kolom = 0 To 1
ComboBox1.Items.Add(arr(baris, kolom))
Next kolom
Next baris
ListView1.Columns.Add("Alamat", 125)
ListView1.Columns.Add("Tempat, Tanggal Lahir", 105)
ListView1.Columns.Add("Telp/Hp", 105)
ListView1.Columns.Add("Email", 110)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim arr(7) As String
arr(0) = TextBox1.Text
arr(1) = TextBox2.Text
arr(2) = ComboBox1.Text
arr(3) = TextBox3.Text
arr(4) = TextBox4.Text
arr(5) = TextBox5.Text
arr(6) = TextBox6.Text
arr(7) = TextBox7.Text
Dim list As New ListViewItem
list = New ListViewItem
list = ListView1.Items.Add(arr(0))
list.SubItems.Add(arr(1))
list.SubItems.Add(arr(2))
list.SubItems.Add(arr(3))
list.SubItems.Add(arr(4))
list.SubItems.Add(arr(5))
list.SubItems.Add(arr(6))
list.SubItems.Add(arr(7))
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox1.Focus()
TextBox1.Clear()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim pesan As String
pesan = MsgBox("Yakin ingin keluar?", vbYesNo, "Konfirmasi")
If pesan = vbYes Then
End
End If
End Sub
End Class
Latihan 3 Array Multidimensi
Berikut Source Codenya :
Public Class latihan6
'nadiahtami 2017230007'
Private Sub latihan6_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox2.Focus()
Dim arr(1, 2) As String
arr(0, 0) = "NIS"
arr(0, 1) = "Nama Siswa"
arr(0, 2) = "Jumlah"
arr(1, 0) = "Rata-Rata"
arr(1, 1) = "Grade"
arr(1, 2) = "Keterangan"
ListView1.GridLines = True
ListView1.View = View.Details
For baris = 0 To 1
For kolom = 0 To 2
ListView1.Columns.Add(arr(baris, kolom), 85)
Next
Next
TextBox1.Text = "171801"
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
TextBox6.Text = Val(TextBox3.Text) + Val(TextBox4.Text) + Val(TextBox5.Text)
TextBox7.Text = FormatNumber((TextBox6.Text) / 3)
End Sub
Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
TextBox6.Text = Val(TextBox3.Text) + Val(TextBox4.Text) + Val(TextBox5.Text)
TextBox7.Text = FormatNumber((TextBox6.Text) / 3)
End Sub
Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
TextBox6.Text = Val(TextBox3.Text) + Val(TextBox4.Text) + Val(TextBox5.Text)
TextBox7.Text = FormatNumber((TextBox6.Text) / 3)
End Sub
Private Sub TextBox7_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox7.TextChanged
If TextBox7.Text >= 90 Then
TextBox8.Text = "A"
ElseIf TextBox7.Text >= 80 Then
TextBox8.Text = "B"
ElseIf TextBox7.Text >= 70 Then
TextBox8.Text = "C"
ElseIf TextBox7.Text <= 70 Then
TextBox8.Text = "D"
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim arr(5) As String
arr(0) = TextBox1.Text
arr(1) = TextBox2.Text
arr(2) = TextBox6.Text
arr(3) = TextBox7.Text
arr(4) = TextBox8.Text
arr(5) = TextBox9.Text
Dim list As New ListViewItem
list = ListView1.Items.Add(arr(0))
list.SubItems.Add(arr(1))
list.SubItems.Add(arr(2))
list.SubItems.Add(arr(3))
list.SubItems.Add(arr(4))
list.SubItems.Add(arr(5))
TextBox1.Text = Val(TextBox1.Text) + 1
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
TextBox6.Clear()
TextBox8.Clear()
TextBox9.Clear()
TextBox2.Focus()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim pesan As String
pesan = MsgBox("Yakin ingin keluar?", vbYesNo, "Konfirmasi")
If pesan = vbYes Then
End
End If
End Sub
Private Sub TextBox8_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox8.TextChanged
If TextBox8.Text = "A" Then
TextBox9.Text = "Lulus"
ElseIf TextBox8.Text = "B" Then
TextBox9.Text = "Lulus"
ElseIf TextBox8.Text = "C" Then
TextBox9.Text = "Lulus"
ElseIf TextBox8.Text = "D" Then
TextBox9.Text = "Tidak Lulus"
End If
End Sub
End Class
Kasus 1 Array Multidimensi
Berikut Source Codenya :
Public Class kasus2
'nadiahtami 2017230007'
Private Sub kasus2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox6.Focus()
Dim arr(1, 2) As String
arr(0, 0) = "NIM"
arr(0, 1) = "Nama Mahasiswa"
arr(0, 2) = "Jumlah"
arr(1, 0) = "Rata-Rata"
arr(1, 1) = "Grade"
arr(1, 2) = "Keterangan"
ListView1.GridLines = True
ListView1.View = View.Details
For baris = 0 To 1
For kolom = 0 To 2
ListView1.Columns.Add(arr(baris, kolom), 85)
Next
Next
TextBox1.Text = "2017230001"
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
TextBox7.Text = Val(TextBox3.Text) + Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text)
TextBox8.Text = FormatNumber((TextBox7.Text) / 4)
End Sub
Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
TextBox7.Text = Val(TextBox3.Text) + Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text)
TextBox8.Text = FormatNumber((TextBox7.Text) / 4)
End Sub
Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
TextBox7.Text = Val(TextBox3.Text) + Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text)
TextBox8.Text = FormatNumber((TextBox7.Text) / 4)
End Sub
Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
TextBox7.Text = Val(TextBox3.Text) + Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text)
TextBox8.Text = FormatNumber((TextBox7.Text) / 4)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim arr(5) As String
arr(0) = TextBox1.Text
arr(1) = TextBox2.Text
arr(2) = TextBox7.Text
arr(3) = TextBox8.Text
arr(4) = TextBox9.Text
arr(5) = TextBox10.Text
Dim list As New ListViewItem
list = New ListViewItem
list = ListView1.Items.Add(arr(0))
list.SubItems.Add(arr(1))
list.SubItems.Add(arr(2))
list.SubItems.Add(arr(3))
list.SubItems.Add(arr(4))
list.SubItems.Add(arr(5))
TextBox1.Text = Val(TextBox1.Text) + 1
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
TextBox6.Clear()
TextBox7.Clear()
TextBox9.Clear()
TextBox10.Clear()
TextBox2.Focus()
End Sub
Private Sub TextBox9_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox9.TextChanged
If TextBox9.Text = "A" Then
TextBox10.Text = "Lulus"
ElseIf TextBox9.Text = "B" Then
TextBox10.Text = "Lulus"
ElseIf TextBox9.Text = "C" Then
TextBox10.Text = "Lulus"
Else
TextBox10.Text = "Tidak Lulus"
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim pesan As String
pesan = MsgBox("Yakin ingin keluar?", vbYesNo, "Konfirmasi")
If pesan = vbYes Then
End
End If
End Sub
Private Sub TextBox8_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox8.TextChanged
If TextBox8.Text >= 90 Then
TextBox9.Text = "A"
ElseIf TextBox8.Text >= 80 Then
TextBox9.Text = "B"
ElseIf TextBox8.Text >= 70 Then
TextBox9.Text = "C"
ElseIf TextBox8.Text < 70 Then
TextBox9.Text = "D"
End If
End Sub
End Class
Komentar
Posting Komentar