如题,希望高手指点
谢谢

解决方案 »

  1.   

    'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
    'Add 1 Text Box and 1 Label to your form. Change Text Box MultiLine property to True.
    'Insert this code to the module :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'Insert the following code to your form:Private Sub Text1_Change()
    Dim lineCount As Long
    On Local Error Resume Next
    lineCount = SendMessageLong(Text1.hwnd, EM_GETLINECOUNT, 0&, 0&)
    Label1 = Format$(lineCount, "##,###")
    End Sub
      

  2.   

    Option ExplicitPrivate 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
    Private Const EM_GETLINECOUNT = &HBA
    Sub Text1_Change()
        Dim lineCount As Long
        On Local Error Resume Next
        '得到/显示文本行数
        lineCount = SendMessageLong(Text1.hwnd, EM_GETLINECOUNT, 0&, 0&)
        Label1 = Format$(lineCount, "##,###")End Sub