How can I change the position of form1 on the screen with code.
Printable View
How can I change the position of form1 on the screen with code.
Form1.left=500, form1.top=500
If you intend to change both the X and Y coordinate it is better to set the Location property rather than the Top and Left individually, which is actually visible to the user, e.g.VB Code:
form1.Location = New Point(500, 500)
Thank you!
Well its marked as resolved already, but I don't want to start a new thread for the same issue.
Why is that not working.VB Code:
Form1.Left = Form1.Left + 200 Form1.Top = Form1.Top + 200
I'm going to guess that "Form1" is the name of a class. These are instance members, which means that you can only change their values for a specific instance of Form1, e.g.VB Code:
Dim myForm1 As New Form1 myForm1.Left += 200 myForm1.Top += 200
If you want to use any members of the current instance you qualify them with "Me", e.g.Strictly speaking the "Me." is not required, but it is good practice to include it for clarity and it means you get help from Intellisense as well.VB Code:
Me.Left += 200 Me.Top += 200