Microsoft KB Archive/183257

{|
 * width="100%"|

FIX: SelText Does Not Return Last Character in Text Box

 * }

Q183257

-

The information in this article applies to:


 * Microsoft Windows CE Toolkit for Visual Basic 5.0, version 1.0

-

SYMPTOMS
If the selected text within a textbox includes the last character of the controls Text property, the SelText property will not include the last character.

RESOLUTION
To work around this problem, you can use the SelStart and SelLength properties to capture the selected string:

  Dim strSelected

If Text1.SelLength > 0 then strSelected = Mid(Text1.Text, Text1.SelStart + 1, Text1.SelLength)

End If

STATUS
Microsoft has confirmed this to be a problem in the Microsoft products that are listed at the beginning of this article.

This problem was corrected in Windows CE Toolkit for Visual Basic 6.0.

MORE INFORMATION
When the selected text includes the last character of the control's Text property, the SelText property will not include the last character.

For example, assume a textbox control contains the characters "this is a test" (without the quotation marks):

++ ++ ++ ++
 * If the selected text is:    |         SelText Property     |
 * "is a test"               |            "is a tes"        |
 * "This is a"               |            "This is a"       |