Form1 Button Combobox Object Eventargs: ' Belajar Array

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

' belajar array

Public Class Form1


Dim WithEvents cmd1 As New Button
Dim WithEvents cbox1 As New ComboBox
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Me.Controls.Add(Me.cmd1)
Me.Controls.Add(Me.cbox1)
Me.cbox1.Location = New System.Drawing.Point(10, 40)
'cmd1
Me.cmd1.Location = New System.Drawing.Point(55, 10)
Me.cmd1.Text = "OK"
Me.cbox1.Enabled = False
End Sub
Private Sub cmd1_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
cmd1.Click
' cara penulisan array vb.NET
Dim nama_hewan(3) As String
nama_hewan(0) = "Sapi"
nama_hewan(1) = "Monyet"
nama_hewan(2) = "Kuda"
nama_hewan(3) = "Kucing"
For Each hewan As String In nama_hewan
Me.cbox1.Items.Add(hewan)
Next
Me.cbox1.Text = "Nama-Nama hewan"
Me.cbox1.Enabled = True
End Sub
End Class

You might also like