|
-
Jan 23rd, 2007, 09:51 AM
#1
Scroll bar in Textbox(thanks to JCIS)
Dear All,
I found this (thanks to JCIS)code to set the scroll bar to text box when it necessary.It works good .But i face one problem.It is not scrolling when i click the scroll bar.Can some body help. I studied the problem as I have set the multiline to False, ,Because I dont want to allow the user to type more than one line
Last edited by danasegarane; Jan 23rd, 2007 at 09:54 AM.
Please mark you thread resolved using the Thread Tools as shown
-
Jan 23rd, 2007, 09:58 AM
#2
Re: Scroll bar in Textbox(thanks to JCIS)
That code is working perfectly for me.
Did you remember to "Set Multiline property = true and Scrollbars property = Both" at design time ?
-
Jan 23rd, 2007, 10:04 AM
#3
Re: Scroll bar in Textbox(thanks to JCIS)
Dear IPrank,
I want to restrict the user to only one line.So I set the Multiline=False.Is there any method to solve this issue?
Please mark you thread resolved using the Thread Tools as shown
-
Jan 23rd, 2007, 10:39 AM
#4
Show/hide Scrollbar On a SingleLine TextBox
Here is a little modified version of jcis's code that works on SingleLine textboxes.
This is actually a MultiLine text box, but it simulates like a singleline textbox.
Set Multiline = True and Scrollbar = Horizontal at designtime.
VB Code:
Option Explicit
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 Sub Form_Load()
CheckScrollBars
End Sub
Private Sub Text1_Change()
CheckScrollBars
End Sub
Private Sub CheckScrollBars()
If Me.TextWidth(Text1.Text) > (Text1.Width - 100) Then 'Wider than width?
ShowScrollBar Text1.hWnd, SB_HORZ, True 'Make HScrollbar visible
Else
ShowScrollBar Text1.hWnd, SB_HORZ, False 'Hide HScrollbar
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 10 Or KeyAscii = 13 Then KeyAscii = 0
End Sub
Last edited by iPrank; Jan 23rd, 2007 at 11:19 AM.
-
Jan 23rd, 2007, 10:51 AM
#5
Re: Scroll bar in Textbox(thanks to JCIS)
Dear IPrank,
Thanks for your reply.It is not scrolling.?
Please mark you thread resolved using the Thread Tools as shown
-
Jan 23rd, 2007, 10:53 AM
#6
Re: Scroll bar in Textbox(thanks to JCIS)
If the user can only type one line of text what is there to scroll?
-
Jan 23rd, 2007, 10:56 AM
#7
Re: Scroll bar in Textbox(thanks to JCIS)
If the Text contents is more than the width of the textbox then there should be scrollbar to scroll.?
Please mark you thread resolved using the Thread Tools as shown
-
Jan 23rd, 2007, 10:57 AM
#8
Re: Scroll bar in Textbox(thanks to JCIS)
I think I can close this thread if this is solved
Please mark you thread resolved using the Thread Tools as shown
-
Jan 23rd, 2007, 11:20 AM
#9
Re: Scroll bar in Textbox(thanks to JCIS)
Edited my previous code. it should work now.
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
|