Hi all
How can I change control location (x,y)
so when I click button the position (location property) will change
thanks
Printable View
Hi all
How can I change control location (x,y)
so when I click button the position (location property) will change
thanks
vb Code:
label1.location = new point(20,20)
edit: do you mean you want to move the button when you click on it?
its the same method anyway
Are you meaning like click on a coordinate on your form and the control moves to that location?
If so just use the Form's Click event.
Code:Option Explicit On
Option Strict On
Public Class Form1
Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
If e.Button = Windows.Forms.MouseButtons.Left Then
Me.Button1.Location = e.Location
End If
End Sub
End Class