Solved

textbox- Scroll bars problem

Posted on 2002-04-11
4
299 Views
Last Modified: 2012-05-04
HI,
I have a textbox,
I have set its properties as
Multiline to true
Scrollbars to both
locked to true

i have locked it because i dont want its contents to be edited.
the problem now is, when i display big messages, its scrollbars are not enabled. i want its scroll bars enabled and still lock the contents. i dont want the textbox to be disabled.
0
Comment
Question by:RanjiniPraba
4 Comments
 
LVL 22

Expert Comment

by:rspahitz
Comment Utility
You can always try this code:

Private Sub Text1_KeyPress(KeyAscii As Integer)
  KeyAscii = 0
End Sub

This won't stop people from pasting with the mouse or menu, but will at least stop keyboard input.  That should cover most cases.
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
unlock it and in the keydown event set the keycode argument to 0.
0
 
LVL 18

Accepted Solution

by:
mdougan earned 15 total points
Comment Utility
One final thing.  If you have a multi-line textbox, you really shouldn't have a horizontal scrollbar.  I haven't tried it lately, but it used to be that you couldn't get the text to wrap if you had a horizontal scrollbar.

Without a horizontal scrollbar (but with a vertical one) then text will automatically wrap around if multi-line is set to true.
0
 
LVL 20

Expert Comment

by:hes
Comment Utility
I tried this
Textbox Text1
Multiline to true
Scrollbars to both
locked to true


Dim t As String
t = Clipboard.GetText

Text1.Text = t

Copied this entire Question to the clipboard and ran teh program.
Both scrollbars worked just fine
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now