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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setfocus to textbox with input mask

Status
Not open for further replies.

ZOR

Technical User
Joined
Jan 30, 2002
Messages
2,963
Location
GB
I have a textbox with an input mask 00:00:00:00

When I set focus to it, its all highlighted in black, how can I get the cursor at the front and no total highlighting. I tried selstart but that does not seem to want to do it. Any ideas, thanks
 
Howdy ZOR . . .

Have a look at the [blue]SelStart[/blue] property.

Calvin.gif
See Ya! . . . . . .
 
Thanks, however as I said, selstart does not do what I want. The whole field goes black with the cursor at the front (left). I don't want the whole textbox highlighted or whatever its called when it's blacked in.
 
I have bodged it. I set focus to the textbox, and make its value = "", the inputmask is not there to see, the cursor blinks in the control, but as soon as a first digit is entered the mask appears. Probably the best I will get?
 
Try this
[tt]Me.Text0.SelLength = Me.Text0.SelStart[/tt]

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Thanks Zameer, but it still returns to the textbox fully enclosed. Thanks for trying, but I will just use the method of making the textbox = "" and have the cusor blink in the middle with no mask showing until the first digit gets entered. I also tried reversing your code to see if it would work. Regards.
 
This is working for me
Code:
Private Sub Text0_Enter()
Me.Text0.SelLength = 0
End Sub
selecting only the first digit
Inputmask is
00:00:00:00;0;:

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Played with it again, and no, still does not do it. Been into options to check focus on partial highlighting. I then tried to do another part of the program, where I looked for the Len of the text0, it always gave 11 being its mask of 00:00:00:00. Never mind I am working around it and will leave it as is as it seems to be okay operationally. Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top