Hello,

Is possible when thorn with stylus (Pocket PC) upon a TextBox selects the text? I have tried with the GotFocus Event and SelectAll method but does not work. Also I found a code in this forum but it does not work either

Some solution?

VB Code:
  1. Private Sub TextBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Click
  2.         Dim txtHold As TextBox = CType(sender, TextBox)
  3.  
  4.         For intBeg As Int32 = (txtHold.SelectionStart * -1) To 0
  5.             If Math.Abs(intBeg) = txtHold.Text.Length Then
  6.                 'Beyond the length of the string, nothing selected.
  7.             ElseIf txtHold.Text.Substring(Math.Abs(intBeg), 1) = " " Then
  8.                 txtHold.SelectionStart = Math.Abs(intBeg) + 1
  9.                 txtHold.SelectionLength = selLen(txtHold, intBeg)
  10.                 Exit For
  11.             ElseIf intBeg = 0 Then
  12.                 txtHold.SelectionStart = intBeg
  13.                 txtHold.SelectionLength = selLen(txtHold, intBeg)
  14.             End If
  15.         Next intBeg
  16.     End Sub
  17.     Private Function selLen(ByRef txtHold As TextBox, ByVal intBeg As Int32) As Int32
  18.         For intEnd As Int32 = txtHold.SelectionStart + 1 To txtHold.Text.Length
  19.             If txtHold.Text.Substring(intEnd, 1) = " " Then
  20.                 Return (intEnd - txtHold.SelectionStart)
  21.                 Exit For
  22.             ElseIf intEnd = txtHold.Text.Length - 1 Then
  23.                 Return (intEnd - txtHold.SelectionStart + 1)
  24.                 Exit For
  25.             End If
  26.         Next
  27.     End Function

Thank you