does anyone know a way of finding out the width (in pixels) of the text in a text box?

i am trying to split the contents of a text box into several controls. however, i need to know if the text is longer than the width of the box.

i also need to find a way of knowing which character is the last one that fits in the text box.

i've looked at some APIs, but there must be a way of doing it.

thanks.