Rabu, 30 Maret 2011


<!--[if gte mso 9]> Normal 0 false false false false IN X-NONE X-NONE

Balajar membuat program dengan Listbox, untuk menginput data.

Walau pun dalam mata VB.net ini saya masuk pada saat itu membahas cara pembuatan List Box dengan VB.net. tapi saya tetep ga mau ketinggalan.dan coba bertanya pada teman-teman satu kelas saya akar tidak ketinggalan materi ini. Maklum mahasiswa sambil kerja…..,hahahaahaaha….

Tampilan list box :


Pembahasan kali ini, kita akan coba membuat program untuk menggabungkan data yang kita input, lalu akan kita gabungkan, dan akan ditampilkan melalui listbox…

Perintah sederhananya :

ListBox1.Items.Add(TextBox.Text +" " + TextBox……..)

Step pertama : buat form seperti tampilan di atas, lalu buat coding seperti dibawah ini :

Sub pros3()
ListBox1.Items.Add(TextBox3.Text + " " + TextBox4.Text + " " + TextBox5.Text + " " _
+ TextBox6.Text + " " + TextBox7.Text)
End Sub
Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
If e.KeyChar = Chr(13) Then
TextBox4.Focus()
End If
End Sub
Private Sub TextBox4_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox4.KeyPress
If e.KeyChar = Chr(13) Then
TextBox5.Focus()
End If
End Sub
Private Sub TextBox5_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox5.KeyPress
If e.KeyChar = Chr(13) Then
TextBox6.Focus()
End If
End Sub
Private Sub TextBox6_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox6.KeyPress
If e.KeyChar = Chr(13) Then
TextBox7.Focus()
End If
End Sub

Private Sub TextBox7_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox7.KeyPress
If e.KeyChar = Chr(13) Then
Call pros3()
Call bersihpros()
TextBox3.Focus()
End If
End Sub
Sub bersihpros()
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
End Sub
End Class

Setelah itu temen-temen bisa jalankan program tsb dengan menekan F5,isi kata untuk data 1 diakhiri dengan Enter, hingga data 7 :

Tidak ada komentar:

Posting Komentar