Vertical ScrollBar in RTB

S

ShaneO

In a Windows Form I have a RichTextBox with Multiline = True and
ScrollBars = Vertical. As expected, when Text is loaded into the RTB
the Vertical ScrollBar will appear if needed.

Does anyone know of a way (in Code) to determine if the Vertical
ScrollBar is visible or not? (VB 2005)

This question has been asked a couple of times over several months but
so far nobody has responded.

Thanks in advance to anyone who can provide assistance.

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
 
S

ShaneO

Herfried said:
Thank-you for your link.

I was able to execute your application and I could see the results
(including the extra Properties).

The problem I'm having however is that I can't seem to implement your
code for the enhanced RTB. If I try I get -

"Namespace of type specified in the Imports
'ThemedRichTextBox.NativeMethods' doesn't contain any public member.....

I've added the files - "ExtendedRichTextBox.vb" and "NativeMethods.vb"
but can't do anything beyond that!

I'm also wondering, is it really necessary to add an enhanced control
just to achieve what I want? Surely there must be an easier way to find
out if a ScrollBar is visible or not?!?!?

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
 
H

Herfried K. Wagner [MVP]

ShaneO said:
I was able to execute your application and I could see the results
(including the extra Properties).

The problem I'm having however is that I can't seem to implement your code
for the enhanced RTB. If I try I get -

"Namespace of type specified in the Imports
'ThemedRichTextBox.NativeMethods' doesn't contain any public member.....

I've added the files - "ExtendedRichTextBox.vb" and "NativeMethods.vb" but
can't do anything beyond that!

Replace 'ThemedRichTextBox' in the 'Imports' statement contained in
"ExtendedRichTextBox.vb" with your project's root namespace
('WindowsApplication1' by default).
I'm also wondering, is it really necessary to add an enhanced control just
to achieve what I want? Surely there must be an easier way to find out if
a ScrollBar is visible or not?!?!?

Well, you don't need an inherited control, but it's a good solution because
it encapsulates the p/invoke calls and extends the control by handy
properties.
 
S

ShaneO

Herfried said:
Replace 'ThemedRichTextBox' in the 'Imports' statement contained in
"ExtendedRichTextBox.vb" with your project's root namespace
('WindowsApplication1' by default).
Doh! That was something that should have been obvious!
Well, you don't need an inherited control, but it's a good solution
because it encapsulates the p/invoke calls and extends the control by
handy properties.
Thank-you. Yes, the Extended Properties are something I could probably
take advantage of. Your help has been most valuable.

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top