String length conversion

Hi,

I need to if possible determine the what the length of a string is like "This is a test" in twips.  I need to be able to tell if a particular string's length has exceeded the text box in which it was placed.

Thanks,

JSH
syntelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

VbmasterCommented:
The simplest solution would be to change the form's Font property to the same as your textbox and then see the value of Form.TextWidth("This is a test") <- this property can be found for pictureboxes too, so you could create another picturebox and use that to calculate width of a string.
0
mcriderCommented:
You can use the TextWidth and TextHeight function of a form or a picturebox to determine the length and width in whatever the Scale property is set to...


Cheers!
0
caraf_gCommented:
Vbmaster's point is very important: the font of the control or form that you use the TextWidth and TextHeight functions on MUST be the same as the text box you're working with, otherwise the results will not be accurate.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

syntelAuthor Commented:
Sounds good.  I will implement ASAP and let you know how it goes.

Thanks,

JSH
0
syntelAuthor Commented:
Thanks all.  It works great!

VB master:

If you want the points just say so and I will reject the other answer since your answer was first AND most complete.  If you don't care I will give the points to mcrider.

Again thanks all.

JSH
0
syntelAuthor Commented:
Thanks all.  It works great!

VB master:

If you want the points just say so and I will reject the other answer since your answer was first AND most complete.  If you don't care I will give the points to mcrider.

Again thanks all.

JSH
0
VbmasterCommented:
Ya, rejecting is fun. ;)
0
syntelAuthor Commented:
Rejecting for VBMaster; post something for an answer and the points are yours.

JSH
0
VbmasterCommented:
'Something'
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
syntelAuthor Commented:
You da man...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.