Professional Documents
Culture Documents
Dim a, b, s As Integer
End Sub
listhasil.Items.Clear()
a = Val(txtawal.Text)
b = Val(txtakhir.Text)
s = Val(txtstep.Text)
End If
If a < b Then
If txtstep.Text < 0 Then
s = Val(txtstep.Text) * -1
ElseIf txtstep.Text > 0 Then
s = Val(txtstep.Text) * 1
End If
txtstep.Text = s
For i = a To b Step s
listhasil.Items.Add(i)
Next
listhasil.Items.Clear()
a = Val(txtawal.Text)
b = Val(txtakhir.Text)
s = Val(txtstep.Text)
End If
If a < b Then
If txtstep.Text < 0 Then
s = Val(txtstep.Text) * -1
ElseIf txtstep.Text > 0 Then
s = Val(txtstep.Text) * 1
End If
txtstep.Text = s
Do While (a <= b)
listhasil.Items.Add(a)
a += s
Loop
Loop
End If
End Sub
Private Sub btwhile_Click(sender As Object, e As EventArgs) Handles btwhile.Click
listhasil.Items.Clear()
a = Val(txtawal.Text)
b = Val(txtakhir.Text)
s = Val(txtstep.Text)
If a < b Then
If txtstep.Text < 0 Then
s = Val(txtstep.Text) * -1
ElseIf txtstep.Text > 0 Then
s = Val(txtstep.Text) * 1
End If
txtstep.Text = s
While (a <= b)
listhasil.Items.Add(a)
a += s
End While
a = Val(txtawal.Text)
b = Val(txtakhir.Text)
s = Val(txtstep.Text)
If a < b Then
If txtstep.Text < 0 Then
s = Val(txtstep.Text) * -1
ElseIf txtstep.Text > 0 Then
s = Val(txtstep.Text) * 1
End If
txtstep.Text = s
Do Until a > b
listhasil.Items.Add(a)
a += s
Loop
ElseIf a > b Then
If txtstep.Text < 0 Then
s = Val(txtstep.Text) * 1
ElseIf txtstep.Text > 0 Then
s = Val(txtstep.Text) * -1
End If
txtstep.Text = s
Do Until a < b
listhasil.Items.Add(a)
a += s
Loop
End If
End Sub
End Class
Thank regard
Om toto :D