colordeficiency Posted August 13, 2002 Share Posted August 13, 2002 OK, Simple question. Anyone know how to scroll a textbox by using buttons instead of enabling scrollbars. I need it fast for a project, help! Link to comment Share on other sites More sharing options...
0 colordeficiency Posted August 13, 2002 Author Share Posted August 13, 2002 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 More sharing options...
0 colordeficiency Posted August 13, 2002 Author Share Posted August 13, 2002 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 More sharing options...
Question
colordeficiency
OK, Simple question. Anyone know how to scroll a textbox by using buttons instead of enabling scrollbars. I need it fast for a project, help!
Link to comment
Share on other sites
2 answers to this question
Recommended Posts