|
-
Oct 18th, 2010, 04:09 AM
#1
Thread Starter
Hyperactive Member
changing textbox scrollbars at runtime
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.
-
Oct 18th, 2010, 06:18 AM
#2
Re: changing textbox scrollbars at runtime
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
-
Oct 20th, 2010, 12:01 AM
#3
New Member
Re: changing textbox scrollbars at runtime
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
-
Oct 20th, 2010, 01:02 AM
#4
Re: changing textbox scrollbars at runtime
 Originally Posted by [email protected]
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.
I think you'll find that the ScrollBars property of a RichTextBox are Read only as they are for a TextBox.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|