Contoh VB2
Scrip
Public Class Form2
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
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
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 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
End Class
Tidak ada komentar:
Posting Komentar