Groups | Blog | Home
all groups > vb.net controls > may 2006 >

vb.net controls : how to center a button in vb.net?


Dan
5/26/2006 12:00:00 AM
Hi,

In the aspx file, there is a form (form1) created.
I created a button in the code-behind file like this:
Dim b As Button
b = New Button
form1.Controls.Add(b)

But i want to center the button.
How can i do that in the code-behind file?

Thanks
Dan

Stuart Nathan
5/26/2006 2:58:51 PM
simply do as you might for any control
b.Location = new point((width-b.width)/2,(height-b.height)/2


Dan
5/26/2006 4:27:39 PM
Thanks.
I was wondering whether there was a property doing that ...
[quoted text, click to view]

AddThis Social Bookmark Button