hello please help me on this problem....i put this in form load

txtunit.text = "C"

my problem is that how can i position the cursor after the letter C..if i use txtunit.setfocus the cursor can be found before the letter C but i want it after...please help me.. thanks in advance...hoping for your positive responds...

hello please help me on this problem....i put this in form load

txtunit.text = "C"

my problem is that how can i position the cursor after the letter C..if i use txtunit.setfocus the cursor can be found before the letter C but i want it after...please help me.. thanks in advance...hoping for your positive responds...

hi,
hoping this will help.

go to the 'GotFocus' event procedure of the 'txtunit' control and key in the following

SendKeys "{end}"

the code should look like this

Private Sub txtunit_GotFocus()
  
  SendKeys "{end}"
  
End Sub

or...

textunit.SelStart = Len(textunit.Text)

Good Luck

or...

textunit.SelStart = Len(textunit.Text)

This is a much better solution...

hi thanks for the reply, can you tell me what is that sendkeys? ...hoping for your positive responds.

thanks for the reply i will try this

thanks for the reply i will try this.

hi hello,

can i ask how to put the cursor in the middle of the textbox?..
hoping for your positive responds....

textunit.SelStart = Len(textunit.Text)/2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.