Link to home
Start Free TrialLog in
Avatar of RanjiniPraba
RanjiniPraba

asked on

textbox- Scroll bars problem

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.
Avatar of rspahitz
rspahitz
Flag of United States of America image

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.
Avatar of Éric Moreau
unlock it and in the keydown event set the keycode argument to 0.
ASKER CERTIFIED SOLUTION
Avatar of mdougan
mdougan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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