Hello. I want to change scrollbars of textbox at runtime. But i found it is read-only property. I have another option-to have double textbox. But i don't want to have this. So, is there any other option? May be we could do it by using API.
Thanks.
Printable View
Hello. I want to change scrollbars of textbox at runtime. But i found it is read-only property. I have another option-to have double textbox. But i don't want to have this. So, is there any other option? May be we could do it by using API.
Thanks.
vb Code:
Option Explicit 'make sure scrollbars property is set to (0 NONE) and multiline is set to TRUE. Private Declare Function ShowScrollBar Lib "user32" _ (ByVal hwnd As Long, _ ByVal wBar As Long, _ ByVal bShow As Long) As Long Private Const SB_HORZ = 0 Private Const SB_CTL = 2 ' show or hides the entire control Private Const SB_VERT = 1 Private Const SB_BOTH = 3 Private Sub Command1_Click() 'turn on horiztonal Call ShowScrollBar(Text1.hwnd, SB_HORZ, True) End Sub Private Sub Command2_Click() 'turn them off Call ShowScrollBar(Text1.hwnd, SB_BOTH, False) End Sub
1. Selecting a Normal Text Box and adding the code as said in the above reply is one method.
2. Or else you can use RICHTEXTBOX instead of normal Text Box as this Richtextbox has a propery for scrolldown and you can select any one of the scroll type - eg. horizontal scroll or vertical scroll.
The corresponding ocx for the richtextbox is RICHTX32.OCX
I think you'll find that the ScrollBars property of a RichTextBox are Read only as they are for a TextBox.Quote: