Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving Cursor in textbox

Status
Not open for further replies.

MikeCt

Programmer
Nov 6, 2001
44
US
Hi
Is there a way you can move the cursor past what is entered
in the texbox so that any future typing will be added to
what is already there.

Private Sub Tbox_Brand_Change()

If Trim(Tbox_Brand) <> "" Then
If Len(Trim(Tbox_Brand)) = 1 Then
Tbox_Brand = StrConv(Trim(Tbox_Brand), vbUpperCase)
? Move cursor to right of capitalized leter ?
End If
end if

end sub

Thanks
Mike
 
I finally solved my problem but I did not know how to remove the question so I figured I leave the answer.
Mike

Private Sub Tbox_Brand_Change()

If Trim(Tbox_Brand) <> "" Then
If Len(Trim(Tbox_Brand)) = 1 Then
Tbox_Brand = StrConv(Trim(Tbox_Brand), vbUpperCase)
Tbox_Brand.SelStart = 2
End If
end if

end sub
 
I would think the problem with your code (but perhaps deliberately) is that if someone wants to edit the text it'll keep putting the cursor at the end after they change each letter if you put that code in the _Change event.

However, to do what you want you could more simply say:
Code:
Tbox_Brand.SelStart = Len(TBox_Brand.Text)

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top