PoΦet °ßdk∙ v TextBoxu

Postup:
Zalo₧te nov² projekt. P°idejte modul a v n∞m deklarujte:

Option Explicit

Public 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

Public Const EM_GETLINECOUNT = &HBA

Na formulß° p°idejte TextBox, nastavte mu vlastnost MultiLine na True. P°idejte jmenovku Label1. Pak, na udßlost Change TextBoxu:

Sub Text1_Change()
    Dim lineCount as Long
    On Local Error Resume Next
  
   'ZjiÜt∞nφ poΦtu °ßdek
    lineCount = SendMessageLong(Text1.hwnd,     EM_GETLINECOUNT, 0&, 0&)
    Label1 = Format$(lineCount, "## ###")
End Sub

Spus¥te projekt a zkuste p°idßvat °ßdky do textboxu.

Zp∞t

Autor: The Bozena