Tuesday, July 27, 2010

Public Class Form1
    Dim txtboxes(9) As TextBox
    Dim WithEvents apple As PictureBox

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim txt As TextBox
        For i = 0 To 9
            txt = New TextBox
            txt.BackColor = Color.AliceBlue
            txt.Location = New Point(100, i * 50)
            Me.Controls.Add(txt)
            txtboxes(i) = txt
        Next
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ' animate!
        PictureBox1.Location = New Point(PictureBox1.Location.X, PictureBox1.Location.Y + 4)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Enabled = True
    End Sub

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
        PictureBox1.Visible = False
        Label1.Text = Label1.Text + 100
    End Sub

    Private Sub apple_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles apple.Click
        MessageBox.Show("hello")
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        apple = New PictureBox
        apple.Location = New Point(284, 12)
        apple.ImageLocation = "C:\Users\joshwaxman.CSDEPT.000\Pictures\APPLE.jpg"
        apple.SizeMode = PictureBoxSizeMode.StretchImage
        apple.Size = New Point(90, 90)


        Me.Controls.Add(apple)
    End Sub
End Class

No comments:

Post a Comment