Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As Integer
For a = Val(TextBox1.Text) To Val(TextBox2.Text)
If a Mod 3 = 0 Or a Mod 4 = 0 Or a Mod 7 = 0 Then
ListBox1.Items.Add(a)
Else
ListBox2.Items.Add(a)
End If
Next
For a = Val(TextBox1.Text) To Val(TextBox2.Text)
If a Mod 7 = 0 Then
ListBox3.Items.Add(a)
Else
If a Mod 8 = 0 Then
ListBox3.Items.Add(a)
End If
End If
Next
If Button1.Text = "Proses" Then
Button1.Text = "Sudah Di Proses"
End If
Button2.Focus()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Call bersih()
If Button1.Text = "Sudah Di Proses" Then
Button1.Text = "Proses"
End If
End Sub
Sub bersih()
TextBox1.Text = ""
TextBox2.Text = ""
ListBox1.Items.Clear()
ListBox2.Items.Clear()
ListBox3.Items.Clear()
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = Chr(13) Then
TextBox2.Focus()
End If
End Sub
Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
If e.KeyChar = Chr(13) Then
Button1.Focus()
End If
End Sub
End Class
Tidak ada komentar:
Posting Komentar