ERFORDERLICHE
OBJEKTE
1 Textbox (Text1 - MultiLine=True)
FORM-CODE
Private Declare Function SendMessageLong Lib "User32" _
Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg _
As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const EM_GETLINECOUNT = &HBA
Private Sub Form_Load()
Text1.Text = "Zeile 1"
For x = 2 To 100
Text1.Text = Text1.Text & Chr(13) & Chr(10) & "Zeile " & x
Next x
End Sub
Sub Text_Info()
Dim Anzahl As Long
Dim AktuelleZeile As Long
Anzahl = SendMessageLong(Text1.hwnd, EM_GETLINECOUNT, 0&, 0&)
AktuelleZeile = SendMessageLong(Text1.hwnd, &HC9, -1&, 0&) + 1
Caption = Anzahl & " Zeilen, aktuelle Zeile: " & AktuelleZeile
End Sub
Private Sub Text1_Change()
Call Text_Info
End Sub
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
Call Text_Info
End Sub
|