0% found this document useful (0 votes)
25 views

Form1 Button Combobox Object Eventargs: ' Belajar Array

The document discusses how to write arrays in VB.NET. It defines an array called "nama_hewan" that contains 4 animal names - "Sapi", "Monyet", "Kuda", and "Kucing". A for loop iterates through the array and adds each animal name to the items of a combo box. The combo box text is then set to "Nama-Nama hewan" and enabled.

Uploaded by

haris danuarta
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Form1 Button Combobox Object Eventargs: ' Belajar Array

The document discusses how to write arrays in VB.NET. It defines an array called "nama_hewan" that contains 4 animal names - "Sapi", "Monyet", "Kuda", and "Kucing". A for loop iterates through the array and adds each animal name to the items of a combo box. The combo box text is then set to "Nama-Nama hewan" and enabled.

Uploaded by

haris danuarta
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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