Welcome to my blog, hope you enjoy reading
RSS

home

Selasa, 09 April 2013

program array


Public Class Form1
    Dim namaSiswa(4) As String

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim i As Integer
        For i = 0 To 4
            ComboBox1.Items.Add(i)
        Next
        ComboBox1.TabIndex = 0
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim no As Integer, i As Integer
        no = CInt(ComboBox1.Text)
        namaSiswa(no) = InputBox("Tuliskan Nama siswa no : " & no, "Input Nama Siswa")
        If namaSiswa(no) <> "" Then
            ListBox1.Items.Clear()
            For i = 0 To 4
                ListBox1.Items.Add("namaSiswa (" & i & ")=" & namaSiswa(i))
            Next
        End If
    End Sub


HASIL:






0 komentar:

Posting Komentar