Reputation: 23
I am trying to change the location and size of buttons I have contained in a panel on a WinForm (vb.NET). Initially the buttons have a location and an image (no text), but in execution I want to set a new location and text. I am able to set the text for each button, and as they are set to Autosize, they increase in width. But despite I set the location by code correctly, when the buttons are displayed they "come back" to their initial position.
Any help would be appreciated.
Thanks,
IM
Upvotes: 2
Views: 25837
Reputation: 567
The following code will change the location to the co-ordinates you specify:
Button1.Location = New Point(x, y)
You must change the x,y values to the co-ordinates on the form that you want to move the button too.
The next bit of code with change the size of your button:
Button1.Height = 10
Button1.Width = 50
Upvotes: 9