BOTTOM HOME
This page contains random programming notes that might be useful.
Visual Basic VB.Net, and C++ for Arduino.
TOP
Counting the number of lines in a multiline TextBox - VB.Net
This code was posted by Gadget at https://bytes.com/topic/net/answers/565971-vs-2005-em_getlinecount
Public Class AnyClass
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lparam As Integer) As Integer
Private Const EM_GETLINECOUNT As Integer = &HBA '''which is 186
Private Sub AnyProcedure()
Call TextBoxLineCount()
End Sub
Private Sub TextBoxLineCount()
Dim LineCount As Integer
Dim Message As String
LineCount = SendMessage(TextBox1.Handle.ToInt32, EM_GETLINECOUNT,0,0)
Message ="Line Count = " & LineCount.ToString
MsgBox (Message, vbOKOnly,"title")
End Sub
End Class
TOP

TOP HOME