By using the Microsoft Windows® application programming interface (API) SetScrollRange function, you can add code to your Visual Basic application that will allow you to create a work-around solution. This enables you to change the Text Box's appearance from single to multiline at run time.
The SetScrollRange function lets you set the minimum and maximum indicator positions of a scroll bar. To use this function, add the following Declare statement to the General Declarations section of your form (note that the Declare statement must be typed as a single line of code):
Private Declare Sub SetScrollRange Lib "User" (ByVal hWnd As Integer, ByVal nBar
As Integer, ByVal nMinPos As Integer, ByVal nMaxPos As Integer, ByVal
bRedraw As Integer)
Hmm...
Mistake in MSDN?!
should be: not ''USER'', but ''USER32''
Private Declare Sub SetScrollRange Lib "User32" (ByVal hWnd As Integer, ByVal nBar
As Integer, ByVal nMinPos As Integer, ByVal nMaxPos As Integer, ByVal
bRedraw As Integer)
Not a mistake in MSDN as such, more a fact that MSDN has historical articles. The one quoted actually referes to VB3 and 16-bit windows. In summary, refernces to integer should be replaced with references to Longs
is what I tried, but this procedure is just setting the vertical Scroll Bar to the Text Box & not making it multiline. I want the TextBox changing from Singleline to Multiline at Run-Time. ______________________________
- Regards Rohan (India,Mumbai)
Yeh, realy this function create "create a work-around solution"
You will need to change style:
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
offset is: GWL_STYLE = (-16)
new style is: ES_MULTILINE (&H4&)
like SetWindowLong obj.hwnd, GWL_STYLE, new_style
Even this SetWindowLong is not helping..
it is not setting the text box to Multiline at run-time ______________________________
- Regards Rohan (India,Mumbai)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.