Contoh Program Vb.net
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Call gfor()
Call dowhile()
End Sub
sub gfor()
Dim I As Integer
ListBox1.Items.Clear()
For I = Val(TextBox1.Text) To Val(TextBox2.Text)
If I Mod 3 = 0 And I Mod 7 > 0 Then
ListBox1.Items.Add(I)
End If
Next
End Sub
Sub dowhile()
Dim A As Integer
ListBox2.Items.Clear()
A = Val(TextBox1.Text)
Do While A <= Val(TextBox2.Text)
If Microsoft.VisualBasic.Right(A, 1) = 3 Then
ListBox2.Items.Add(A)
End If
A = A + 1
Loop
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
End Sub
End Class
Tidak ada komentar:
Posting Komentar