Hello, I am a recent convert from VB6 to 2010VB express. In .net, how would I add a control (lets say a panel), and move it down the screen based on the ticks of a timer. In VB6 I would use a timer event, and change the .TOP value. I cannot get this to work in .net, perhaps I am creating the control incorrectly. My goal is to make several identical tiles (panels) and move them about the screen via programing when a button is clicked. Here is the code I have been attempting to get to work.
Thanks in advance.
Public Class Form1
Dim WithEvents pnljob2 As Panel
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim pnljob2 As New Panel
With pnljob2
.Name = "pnljob3"
.Size = New Point(249, 102)
.Location = New Point(143, 100)
.BorderStyle = BorderStyle.FixedSingle
End With
Me.Controls.Add(pnljob2) 'adds the control to the form, but I dont know how to address the control outside of this sub.
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'Something goes here to move the control down the screen
Timer1.Enabled = True
End Sub
end class
Thanks in advance.
Public Class Form1
Dim WithEvents pnljob2 As Panel
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim pnljob2 As New Panel
With pnljob2
.Name = "pnljob3"
.Size = New Point(249, 102)
.Location = New Point(143, 100)
.BorderStyle = BorderStyle.FixedSingle
End With
Me.Controls.Add(pnljob2) 'adds the control to the form, but I dont know how to address the control outside of this sub.
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'Something goes here to move the control down the screen
Timer1.Enabled = True
End Sub
end class