-
I need to see how many lines are in a RichEdit control in my program. It Delphi i could get it by saying RichEdit1.Lines.Count but don't see anything similar in VB yet. Any suggestions?
Oh, also how about the character count... Do I just do a Len(RichEdit1.text) ?
Thanks alot!
WarrenW
-
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_GETLINECOUNT = &HBA
Private Sub Command1_Click()
Dim lines As Long
lines = SendMessage(RichTextBox1.hwnd, EM_GETLINECOUNT, 0, 0)
End Sub
-
Or you can use the RichTextBox's GetLineFromChar property.
Code:
Msgbox RichTextBox1.GetLineFromChar(RichTextBox1.SelStart)