PC Review


Reply
Thread Tools Rate Thread

How do I position the cursor to a specif textbox

 
 
Tony Johansson
Guest
Posts: n/a
 
      6th Apr 2009
Hello!

I want to be able to position the curson to a specific textbox in certain
occasions.
How can I do that ?

//Tony


 
Reply With Quote
 
 
 
 
Tony Johansson
Guest
Posts: n/a
 
      6th Apr 2009
Hello!

This works in the situation when I input something that is not valid and
want to set the cursor back so a
correction can be made.

Now I want to set the cursor as soon as the form is displayed.
In a way fetch the event when the form is displayed and here set the cursor
to a specic textbox.

//Tony

"Peter Duniho" <(E-Mail Removed)> skrev i meddelandet
news(E-Mail Removed)...
> On Mon, 06 Apr 2009 02:23:59 -0700, Tony Johansson
> <(E-Mail Removed)> wrote:
>
>> Hello!
>>
>> I want to be able to position the curson to a specific textbox in certain
>> occasions.
>> How can I do that ?

>
> See Control.Focus()



 
Reply With Quote
 
Bjørn Brox
Guest
Posts: n/a
 
      6th Apr 2009
Tony Johansson skrev:
> Hello!
>
> This works in the situation when I input something that is not valid and
> want to set the cursor back so a
> correction can be made.
>
> Now I want to set the cursor as soon as the form is displayed.
> In a way fetch the event when the form is displayed and here set the cursor
> to a specic textbox.
>


As Peter says: use Control.Focus()

If you want to do this when the form is loaded, well do that in the Load
event.

If you want a specific position or having the initial text selected you
use the selection parameters of the text box as well.

--
Bjørn Brox
 
Reply With Quote
 
joecool1969@live.com
Guest
Posts: n/a
 
      6th Apr 2009
On Apr 6, 7:16*am, Bjørn Brox <bpb...@gmail.com> wrote:
> Tony Johansson skrev:
>
> > Hello!

>
> > This works in the situation when I input something that is not valid and
> > want to set the cursor back so a
> > correction can be made.

>
> > Now I want to set the cursor as soon as the form is displayed.
> > In a way fetch the event when the form is displayed and here set the cursor
> > to a specic *textbox.

>
> As Peter says: use Control.Focus()
>
> If you want to do this when the form is loaded, well do that in the Load
> event.
>
> If you want a specific position or having the initial text selected you
> use the selection parameters of the text box as well.


I have found that Control.Focus() doesn't work in the form Load event,
but does in the form Shown event.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cursor position in textbox raju Microsoft Access Form Coding 1 4th Sep 2006 02:34 PM
>> Cursor Position in textbox =?Utf-8?B?Sm9uYXRoYW4=?= Microsoft Access Form Coding 6 11th May 2006 06:03 AM
Textbox Cursor Position Will Lastname Microsoft ASP .NET 1 14th Sep 2005 07:21 AM
Cursor position in TextBox Doug Bell Microsoft VB .NET 1 24th Aug 2005 01:57 PM
Textbox cursor position Tom Microsoft VB .NET 2 20th Feb 2004 03:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:24 PM.