Link to home
Start Free TrialLog in
Avatar of chadmanvb
chadmanvb

asked on

center label in a form

I know how to center a label on my form for a fixed Length, but I have a variable that will change in length.  I would like it to display in the center regardless of the length.  How would I do that?  Thanks, Chad
SOLUTION
Avatar of gangwisch
gangwisch

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chadmanvb
chadmanvb

ASKER

I just tried this, but it does not work
dim x as integer=form1.width/2 - label1.width/2
label1.location=new point(x,y)

 If I do it like:

dim x as integer=485/2 - label1.width/2
label1.location=new point(x,205)

This works, but would get messed up if I change the form size.

It does not like the "form1.width"?  It recomended I try using me instead, but could not get that to work either.  Am I missing something?  Not a big deal because this will also work.

Thanks, Chad
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks worked great!  Chad