470,641 Members | 2,653 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,641 developers. It's quick & easy.

Vertical ScrollBar in RTB

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.
Jan 30 '07 #1
4 2479
"ShaneO" <sp****@optusnet.com.auschrieb:
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)
Check out my implementation that uses p/invoke:

<URL:http://dotnet.mvps.org/dotnet/samples/controls/ThemedRichTextBox.zip>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Jan 30 '07 #2
Herfried K. Wagner [MVP] wrote:
"ShaneO" <sp****@optusnet.com.auschrieb:
>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)

Check out my implementation that uses p/invoke:

<URL:http://dotnet.mvps.org/dotnet/samples/controls/ThemedRichTextBox.zip>
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.
Jan 30 '07 #3
"ShaneO" <sp****@optusnet.com.auschrieb:
>>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)

Check out my implementation that uses p/invoke:

<URL:http://dotnet.mvps.org/dotnet/samples/controls/ThemedRichTextBox.zip>

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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jan 31 '07 #4
Herfried K. Wagner [MVP] wrote:
>>
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).
Doh! That was something that should have been obvious!
>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.
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.
Jan 31 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Gene Hubert | last post: by
reply views Thread by jazeelkm | last post: by
???
1 post views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.