• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 152
  • Last Modified:

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
0
syntel
Asked:
syntel
1 Solution
 
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 new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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
 
syntelAuthor Commented:
You da man...
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now