Powered By Blogger

Kamis, 31 Maret 2011

materi 1


Public Class Form1

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

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
ComboBox1.Items.Add(TextBox1.Text)
End If
End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
ListBox1.Items.Clear()
For i = 5 To Val(TextBox2.Text)
If i Mod 2 = 0 Then
ListBox1.Items.Add(i * -1)
Else
ListBox1.Items.Add(i)
End If
Next
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim a, b, c As Integer
b = 10
c = 12
For a = 10 To Val(TextBox2.Text)
If a Mod b = 0 Then
ListBox1.Items.Add(a)
b = a
Else
If a Mod c = 0 Then
ListBox1.Items.Add(a * -1)
c = a
End If
End If
Next
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim a, b, c As Integer
b = 9
c = 27

For a = 1 To Val(TextBox2.Text)
If a Mod b = 0 Then
If a Mod c = 0 Then
ListBox1.Items.Add(a)
c = a
End If
End If
Next
End Sub
End Class

Tidak ada komentar:

Posting Komentar