how to center a button in vb.net?

D

Dan

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
 
S

Stuart Nathan

simply do as you might for any control
b.Location = new point((width-b.width)/2,(height-b.height)/2
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,141
Latest member
BlissKeto
Top