• 0

VB .NET Help :x


Question

2 answers to this question

Recommended Posts

  • 0

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _

hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _

lParam As Any) As Long

Const EM_LINESCROLL = &HB6

' Scroll the contents of the control.

'

' Positive values scroll left and up, negative values scroll right and down.

' IMPORTANT: you can only scroll TextBox control to which the corresponding

' scrollbar (horizontal or vertical) is associated

Sub TextBoxScroll(tb As TextBox, ByVal HorizScroll As Long, _

ByVal VertScroll As Long)

SendMessageByVal tb.hwnd, EM_LINESCROLL, HorizScroll, VertScroll

End Sub

I found this but it's for VB6. Any kind soul could help me out?

Link to comment
Share on other sites

  • 0

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _

hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _

lParam As Any) As Long

Const EM_LINEFROMCHAR = &HC9

Const EM_LINEINDEX = &HBB

' Get the line/column coordinates of a given character (both are zero-based).

' If charIndex is negative, it returns the coordinates of the caret

Sub TextBoxGetLineColumn(tb As TextBox, ByVal charIndex As Long, line As Long, _

column As Long)

If charIndex < 0 Then charIndex = tb.SelStart

' Get the line number.

line = SendMessage(tb.hwnd, EM_LINEFROMCHAR, charIndex, ByVal 0&)

' Get the column number by subtracting the line's start

' index from the caret position

column = tb.SelStart - SendMessage(tb.hwnd, EM_LINEINDEX, line, ByVal 0&)

End Sub

This too

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.