|
-
Sep 16th, 2000, 09:30 PM
#1
ok, so I have a button thst I want to use to take the cursor
in a RichText Box from where ever it is in the box, to the beginning of the test in the box, how could I do that?
-
Sep 16th, 2000, 09:34 PM
#2
Conquistador
do you mean the mouse cursor or the flashing cursor in the rtb?
code for setting flashing cursor pos in rtb
Code:
Private Sub Text1_GotFocus()
RTB1.SelStart = 0
End Sub
-
Sep 16th, 2000, 09:36 PM
#3
Use the RichTextBox's SelStart property and then set focus to it:
Code:
RichTextBox1.SelStart = 0
RichTextBox1.SetFocus
-
Sep 16th, 2000, 09:47 PM
#4
Conquistador
code to randomize the cursor's position
Code:
'in a module
Declare Function SetCursorPos Lib "user32.dll" (ByVal x As Long, ByVal y As Long) As Long
'wherever
Dim myX As Integer
Dim myY As Integer
Randomize
myX = Int(600 * Rnd)
myY = Int(600 * Rnd)
Debug.Print myX & ":" & myY
retval = SetCursorPos(myX, myY)
-
Sep 16th, 2000, 09:55 PM
#5
Conquistador
Originally posted by Matthew Gates
Use the RichTextBox's SelStart property and then set focus to it:
Code:
RichTextBox1.SelStart = 0
RichTextBox1.SetFocus
bad luck, beat you by two minutes
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
|