How would make a label move throughout a form randomly?
Printable View
How would make a label move throughout a form randomly?
You would randomly select two Integers, create a Point and assign that to the control's Location property, e.g.vb.net Code:
Private rand As New Random Private Sub Timer1_Tick(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Timer1.Tick Dim clientSize As Size = Me.ClientSize Me.Label1.Location = New Point(rand.Next(0, clientSize.Width - Me.Label1.Width), _ rand.Next(0, clientSize.Height - Me.Label1.Height)) End Sub