Sabtu, 30 September 2017

Materi Looping

Buat Form



Logika

Dim i As Integer

'For (+)
Private Sub Command1_Click()
List1.Clear
For i = 1 To 5
    List1.AddItem i
Next i
End Sub

'For(-)
Private Sub Command2_Click()
List2.Clear
For i = 5 To 1 Step -1
    List2.AddItem i
Next i
End Sub

'Do While (+)
Private Sub Command3_Click()
i = 1
Do While i <= 5
    List3.AddItem i
    i = i + 1
Loop
End Sub

'Do Until (+)
Private Sub Command4_Click()
i = 1
Do Until i > 5
    List5.AddItem i
    i = i + 1
Loop
End Sub

'Do While (-)
Private Sub Command5_Click()
i = 5
Do While i >= 1
    List4.AddItem i
    i = i - 1
Loop
End Sub

'Do Until (-)
Private Sub Command6_Click()
i = 5
Do Until i <= 0
    List6.AddItem i
    i = i - 1
Loop

End Sub


Hasil

Kamis, 21 September 2017

Kamis, 14 September 2017