Jumat, 08 Mei 2009

A. PENGULANGAN dalam VISUAL BASIC

1.Pengulangan FOR…NEXT

Format Penulisan :

For variable = nilai awal To nilai akhir
Penyataan atau statement
Next variable

Contoh 1:
kode program :
Private Sub HITUNG_Click()
List1.Clear
For A = Val(Text1) To Val(Text2)
List1.AddItem A
Next
End Sub

Contoh 2 :
Kode program :
Private Sub HITUNG_Click()
List1.Clear
For B = Val(Text1) To Val(Text2)
List1.AddItem "SAYA SEDANG BELAJAR VB"
Next
List1.AddItem "NAMA SAYA ANDI"
End Sub

Contoh 3 :
kode program :
Private Sub HITUNG_Click()
List1.Clear
For C = Val(Text1) To Val(Text2)
List1.AddItem "INI NILAI KE" & C
Next C
List1.AddItem "HORE SAYA BISA BERHITUNG"
End Sub

0 komentar:

Posting Komentar

 
Powered by Blogger