Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long
Private Const EM_GETLINE As Long = &HC4
Private Const EM_LINELENGTH As Long = &HC1
Function GetLineText(TextBox As TextBox, Optional LineNumer As Long = 1) As String
Dim lc As Long, Ret As Long, Str As String
lc = SendMessage(TextBox.hwnd, EM_GETLINECOUNT, 0&, 0&)
Ret = SendMessage(TextBox.hwnd, EM_LINELENGTH, (LineNumer - 1), 0&)
Str = Space(Ret)
SendMessage TextBox.hwnd, EM_GETLINE, (LineNumer - 1), Str
GetLineText = Str
End Function
Private Sub Command1_Click()
MsgBox GetLineText(Text1, 3)
End Sub