|
-
May 27th, 2001, 03:23 PM
#1
Thread Starter
Lively Member
I need Help
how to set the cursor position in a text box control.
Private Sub VBForums_Newthread()
If Thread.Question = Hard then
MSGBox "No one can reply..."
Else If Thread.Question=Easy then
Print "It's very easy.."
MsgBox "God helps those who helps themselves."
End If
End sub
-
May 27th, 2001, 03:36 PM
#2
Frenzied Member
If you mean to set the focus to the text box then use
Code:
Textboxname.SetFocus
-
May 27th, 2001, 03:39 PM
#3
Frenzied Member
But if you mean the mouse cursor then
Code:
Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Declare Function SetCursorPos Lib "user32" Alias "SetCursorPos" (ByVal x As Long, ByVal y As Long) As Long
'somethin like this
Dim r as RECT
GetWindowRect text1.hwnd,r
SetCursorPos r.left + (text1.width /2),r.top + (text1.height/2)
-
May 27th, 2001, 03:44 PM
#4
Thread Starter
Lively Member
no to change the cursor position within the textbox
Private Sub VBForums_Newthread()
If Thread.Question = Hard then
MSGBox "No one can reply..."
Else If Thread.Question=Easy then
Print "It's very easy.."
MsgBox "God helps those who helps themselves."
End If
End sub
-
May 27th, 2001, 03:53 PM
#5
Frenzied Member
You can use
Code:
Private Sub Form_Click()
SendKeys "{RIGHT}", True
End Sub
-
May 27th, 2001, 03:58 PM
#6
Or just change the SelStart property of the TextBox.
Code:
Text1.SelStart = 10
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
|