|
-
April 24th, 2001, 03:13 AM
#1
Stuck again!
I am stuck again! Can anyone help me with this... I am looking for a way in VB to tell me what position the cursor is at in a textbox. Can I do it through the KeyPress event? If so, can somone help me?
-
April 24th, 2001, 04:46 AM
#2
Re: Stuck again!
The Keypress event won't do, for 2 reasons:
1) the keypress event involkes before the character is actually added to the text
2) the keypress event wont fire when you press the arrow buttons
An alternative is the Keyup event. When the event fires, check for the selstart property.
Also make sure to do the same in the click event
private Sub Text1_Click()
Label1.Caption = Text1.SelStart
End Sub
private Sub Text1_KeyUp(KeyCode as Integer, Shift as Integer)
Label1.Caption = Text1.SelStart
End Sub
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|