Buat Form sebagai berikut :
2. Textbox1
3. Button1
4. Button2
5. Combobox1
6. Textboxb2
For i = 1 To 5
ListBox1.Items.Add(i)
Next
End Sub
Lalu klik 2x pada button 2 masukan coding ini
ComboBox1.Items.Clear()
Dim a As Byte
Do While a < 5
a = a + 1
ComboBox1.Items.Add(a)
Loop
End Sub
Kemudian klik 2x pada Listbox1 disini menggunakan " IF Else ", ketikan, codingnya
If ListBox1.Text = "1" Then
TextBox1.Text = "Satu"
ElseIf ListBox1.Text = "2" Then
TextBox1.Text = "dua"
ElseIf ListBox1.Text = "3" Then
TextBox1.Text = "tiga"
ElseIf ListBox1.Text = "5" Then
TextBox1.Text = "lima"
End If
End Sub
Pada combobox codingnya menggunakan "Select Case":
Select Case ComboBox1.Text
Case 1
TextBox2.Text = 1000
Case 2
TextBox2.Text = 2000
Case 3
TextBox2.Text = 3000
Case 4
TextBox2.Text = 4000
Case 5
TextBox2.Text = 5000
End Select
End Sub
End Class
selamat berkreativitas,...klo mau unduh monggo....
Nama-nama objek yang digunakan :
1. Listbox12. Textbox1
3. Button1
4. Button2
5. Combobox1
6. Textboxb2
trus klik 2x pada button 1 lalu ketikan coding berikut
ListBox1.Items.Clear()
Dim i As ByteFor i = 1 To 5
ListBox1.Items.Add(i)
Next
End Sub
ComboBox1.Items.Clear()
Dim a As Byte
Do While a < 5
a = a + 1
ComboBox1.Items.Add(a)
Loop
End Sub
If ListBox1.Text = "1" Then
TextBox1.Text = "Satu"
ElseIf ListBox1.Text = "2" Then
TextBox1.Text = "dua"
ElseIf ListBox1.Text = "3" Then
TextBox1.Text = "tiga"
ElseIf ListBox1.Text = "4" Then
TextBox1.Text = "empat"ElseIf ListBox1.Text = "5" Then
TextBox1.Text = "lima"
End If
End Sub
Select Case ComboBox1.Text
Case 1
TextBox2.Text = 1000
Case 2
TextBox2.Text = 2000
Case 3
TextBox2.Text = 3000
Case 4
TextBox2.Text = 4000
Case 5
TextBox2.Text = 5000
End Select
End Sub
End Class
selamat berkreativitas,...klo mau unduh monggo....
No comments:
Post a Comment