|
-
Mar 11th, 2001, 11:58 PM
#1
Is there any easy way to set the SelStart at the beginning of the current line (or at any line for that matter)
I know you can get the current line but....
Thanks
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Mar 12th, 2001, 12:12 AM
#2
Off the top of my head...
Code:
x = rtf.GetLineFromChar(rtf.SelStart)
Do Until rtf.GetLineFromChar(rtf.SelStart) = x-1
rtf.SelStart = rtf.SelStart -1
Loop
rtf.SelStart = rtf.SelStart + 1
there's probably a hell of a lot easier way, but its late...
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 12th, 2001, 12:23 AM
#3
or perhaps...can you SendKeys the HOME key? I don't know.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 12th, 2001, 04:17 AM
#4
Here you go:
Code:
Private Declare Function SendMessage _
Lib "user32" Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Const EM_LINEINDEX = &HBB
Public Sub JumpToStartOfLine(rtb As RichTextBox)
rtb.SelStart = SendMessage(rtb.hWnd, EM_LINEINDEX, -1, 0)
End Sub
When you pass -1 in the wParam argument you'll get the first character position of the current line.
You could pass any line number to this argument.
Best regards
-
Mar 12th, 2001, 08:24 AM
#5
Hyperactive Member
Joacim,
A question related to your SendMessage solution...
I've noticed that a lot of people use SendMessage for a lot of different things... what's the best way to find out what Messages to send to what types of forms/windows to get particular results?
Thanks...
Achichincle
VB6 (VSEE SP5, W2KPro)
ASP
HTML
-
Mar 12th, 2001, 09:08 AM
#6
Thanks Joacim ..thats PERFECT
much faster now...(instead of starting at the beginning and rechcking verything...just does current line!)
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Mar 12th, 2001, 09:14 AM
#7
Originally posted by Achichincle
Joacim,
A question related to your SendMessage solution...
I've noticed that a lot of people use SendMessage for a lot of different things... what's the best way to find out what Messages to send to what types of forms/windows to get particular results?
Ohhh.... There are thousands of different messages you can send.
One source is of course the MSDN Library.
You can for example search for messages starting with WM_????? or for TextBox and RTF boxes they start with EM_?????.
For Command buttons, Checkboxes and Option buttons the messages starts with BM_???? or BN_?????
Best regards
-
Mar 12th, 2001, 09:26 AM
#8
Hyperactive Member
Joacim,
Ok. Thanks. I see them in the MSDN now...
Achichincle
VB6 (VSEE SP5, W2KPro)
ASP
HTML
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
|