2 Attachment(s)
[RESOLVED] Textbox how do I invert-select the text?
Hi, can anyone please help me on this. I have no idea of how I would code it to select a text in a textbox BUT the cursor must end at the selstart position. How do I do this?? Please help me..:confused: Thanks a lot!
PS: I attached the screenshots for both the unwanted and wanted condition.
Re: Textbox how do I invert-select the text?
this may do ur wish, add a cmd butn and textbox
Code:
Private Sub Command1_Click()
Text1.SetFocus
Text1.SelStart = 10 'starting position
SendKeys "+{LEFT 5}" 'shift + left arrow 5 times
End Sub
Re: Textbox how do I invert-select the text?
Code:
Private Sub Form_Load()
Dim MyArray() As String, i As Integer, j As Integer
'~~> Sample Text
Text1.Text = "Testing Words"
'~~> Split Text "space" as delimiter
MyArray = Split(Text1.Text, " ")
'~~> Moving the cursor to the end of the text
Text1.SelStart = Len(Text1.Text)
'~~> Deciding the number of Chars to move backwards
j = Len(MyArray(UBound(MyArray)))
'~~> Move backwards...
For i = 1 To j
SendKeys "+{Left}"
Next i
End Sub
Edit: Damn... I am late... seenu_1st has already replied... :D
Re: Textbox how do I invert-select the text?
Oh my greatness! Just that easy! Hey thanks guys :D