How to put mouse coursor at left side

M

Marco

How can I put the mouse coursor at the left side of a text box when I click
on the text box?

Thanks,
Marco
 
T

tkelley via AccessMonster.com

From:
http://www.eggheadcafe.com/software/aspnet/31815637/set-the-cursor-position.aspx

"
Set the cursor position - fredg
11-Mar-08 05:49:54

If the user clicks into the field, the cursor position will be where
ever the user has clicked.

If the user tab's into the field, you can position the cursor at the
beginning.
Code the control's Enter event:

Me.[ControlName].SelStart = 1

Or ...

to position it at the end of the existing data, you can use:

Me.[ControlName].SelStart = Len(Me.[ControlName])
 
D

Dirk Goldgar

Marco said:
How can I put the mouse coursor at the left side of a text box when I
click
on the text box?


If you need to override the default behavior when clicking into a text box,
you can code the text box's Click event, like this:

Private Sub MyTextbox_Click()

Me!MyTextbox.SelStart = 0

End Sub
 
F

fredg

From:
http://www.eggheadcafe.com/software/aspnet/31815637/set-the-cursor-position.aspx

"
Set the cursor position - fredg
11-Mar-08 05:49:54

If the user clicks into the field, the cursor position will be where
ever the user has clicked.

If the user tab's into the field, you can position the cursor at the
beginning.
Code the control's Enter event:

Me.[ControlName].SelStart = 1

Or ...

to position it at the end of the existing data, you can use:

Me.[ControlName].SelStart = Len(Me.[ControlName])

--
Fred
"
How can I put the mouse coursor at the left side of a text box when I click
on the text box?

Thanks,
Marco

Just be aware, as stated in this reply, (>If the user tab's into the
field, <) the code will position the cursor at the beginning of the
field only when tabbed into or the control is selected using code.
If the user clicks in the field the cursor will be positioned wherever
the user has clicked.
 
B

BruceM

You may want to check for Null or zero-length first, so that a user can
click to edit.
 
D

Dirk Goldgar

BruceM said:
You may want to check for Null or zero-length first, so that a user can
click to edit.


Good point. It depends on how the text box is to be used.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top