473,498 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Scrollbar Problem

I think I'm going nuts... Put a scroll bar control on a form and in the
form_load method, initialise it as follows:

vScrollBar.Minimum = 0;
vScrollBar.Maximum = 10;
vScrollBar.SmallChange = 1;
vScrollBar.LargeChange = 10;
vScrollBar.Value = 0;
vScrollBar.Visible = true;

In the vScrollBar_ValueChanged event, just display the current value of the
scroll bar. For example:
MessageBox.Show("Value: " + vScrollBar.Value);

When I run this, I expect to be able to click the arrow on the scroll bar to
scroll between 0 and 10. What I actually get is values between 0 and 1; I am
unable to scroll any further. I cannot get a value larger than 1.

Now, if I change the LargeChange value to 1, then everything works again.

Have I missed something fundamental about scroll bars here. I assumed that I
would be able to scroll (by the smallchange amount) from the minimum to the
maximum.

Any ideas? Do I have to intercept the "scroll" event and scroll myself?

Thanks
Steve
Mar 29 '06 #1
6 1492
>> Have I missed something fundamental about scroll bars here.

Yes, IMO, you have. How can the LargeChange value be the same as the
Maximum ? I tried your code, and when the LargeChange and the Maximum
are both set to 10, you see a large bar in between that just moves
between the values of 0 and 1.

However if you correct the LargeChange Value to something like 2, then
it will work just fine.

Hope this helps,.

Regards,

Cerebrus.

Mar 29 '06 #2
Yes, this is correct. It scrolls form min up to max-(largechange - 1)
This is done becaise it is expected that the largechange is the size of the
page. In your case you say that the apge is 10 pixels tall, that means the
first page is from 0-9 and the second page is one pixel tall. If you have
the scrollbar at position 0 there is only line one-pixel tall that is not
visible.
If this wasn't done like this when you move the scroll bar's thumb to the
max position you will see one empty page.

In order to get the full range set the LargeChange to 1.
--
HTH
Stoitcho Goutsev (100)

"Steve Barnett" <no****@nodomain.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I think I'm going nuts... Put a scroll bar control on a form and in the
form_load method, initialise it as follows:

vScrollBar.Minimum = 0;
vScrollBar.Maximum = 10;
vScrollBar.SmallChange = 1;
vScrollBar.LargeChange = 10;
vScrollBar.Value = 0;
vScrollBar.Visible = true;

In the vScrollBar_ValueChanged event, just display the current value of
the scroll bar. For example:
MessageBox.Show("Value: " + vScrollBar.Value);

When I run this, I expect to be able to click the arrow on the scroll bar
to scroll between 0 and 10. What I actually get is values between 0 and 1;
I am unable to scroll any further. I cannot get a value larger than 1.

Now, if I change the LargeChange value to 1, then everything works again.

Have I missed something fundamental about scroll bars here. I assumed that
I would be able to scroll (by the smallchange amount) from the minimum to
the maximum.

Any ideas? Do I have to intercept the "scroll" event and scroll myself?

Thanks
Steve

Mar 29 '06 #3
I suppose that makes sense, it just doesn't "feel" right. However, it does
explain what's happening and I suppose I could always set the "maximum"
value of my scroll bar to the required maximum + the largechange value.
That'd solve my specific needs.

Thanks
Steve
"Stoitcho Goutsev (100)" <10*@100.com> wrote in message
news:OR**************@tk2msftngp13.phx.gbl...
Yes, this is correct. It scrolls form min up to max-(largechange - 1)
This is done becaise it is expected that the largechange is the size of
the page. In your case you say that the apge is 10 pixels tall, that means
the first page is from 0-9 and the second page is one pixel tall. If you
have the scrollbar at position 0 there is only line one-pixel tall that is
not visible.
If this wasn't done like this when you move the scroll bar's thumb to the
max position you will see one empty page.

In order to get the full range set the LargeChange to 1.
--
HTH
Stoitcho Goutsev (100)

"Steve Barnett" <no****@nodomain.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I think I'm going nuts... Put a scroll bar control on a form and in the
form_load method, initialise it as follows:

vScrollBar.Minimum = 0;
vScrollBar.Maximum = 10;
vScrollBar.SmallChange = 1;
vScrollBar.LargeChange = 10;
vScrollBar.Value = 0;
vScrollBar.Visible = true;

In the vScrollBar_ValueChanged event, just display the current value of
the scroll bar. For example:
MessageBox.Show("Value: " + vScrollBar.Value);

When I run this, I expect to be able to click the arrow on the scroll bar
to scroll between 0 and 10. What I actually get is values between 0 and
1; I am unable to scroll any further. I cannot get a value larger than 1.

Now, if I change the LargeChange value to 1, then everything works again.

Have I missed something fundamental about scroll bars here. I assumed
that I would be able to scroll (by the smallchange amount) from the
minimum to the maximum.

Any ideas? Do I have to intercept the "scroll" event and scroll myself?

Thanks
Steve


Mar 29 '06 #4
Steve,

this is what all programers do when they implement scrolling in their
applications and MS embeded it in the scorllbar controls.
There is a TrackBar control that one can use to set values instead of
scrolling.
--

Stoitcho Goutsev (100)

"Steve Barnett" <no****@nodomain.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I suppose that makes sense, it just doesn't "feel" right. However, it does
explain what's happening and I suppose I could always set the "maximum"
value of my scroll bar to the required maximum + the largechange value.
That'd solve my specific needs.

Thanks
Steve
"Stoitcho Goutsev (100)" <10*@100.com> wrote in message
news:OR**************@tk2msftngp13.phx.gbl...
Yes, this is correct. It scrolls form min up to max-(largechange - 1)
This is done becaise it is expected that the largechange is the size of
the page. In your case you say that the apge is 10 pixels tall, that
means the first page is from 0-9 and the second page is one pixel tall.
If you have the scrollbar at position 0 there is only line one-pixel tall
that is not visible.
If this wasn't done like this when you move the scroll bar's thumb to the
max position you will see one empty page.

In order to get the full range set the LargeChange to 1.
--
HTH
Stoitcho Goutsev (100)

"Steve Barnett" <no****@nodomain.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I think I'm going nuts... Put a scroll bar control on a form and in the
form_load method, initialise it as follows:

vScrollBar.Minimum = 0;
vScrollBar.Maximum = 10;
vScrollBar.SmallChange = 1;
vScrollBar.LargeChange = 10;
vScrollBar.Value = 0;
vScrollBar.Visible = true;

In the vScrollBar_ValueChanged event, just display the current value of
the scroll bar. For example:
MessageBox.Show("Value: " + vScrollBar.Value);

When I run this, I expect to be able to click the arrow on the scroll
bar to scroll between 0 and 10. What I actually get is values between 0
and 1; I am unable to scroll any further. I cannot get a value larger
than 1.

Now, if I change the LargeChange value to 1, then everything works
again.

Have I missed something fundamental about scroll bars here. I assumed
that I would be able to scroll (by the smallchange amount) from the
minimum to the maximum.

Any ideas? Do I have to intercept the "scroll" event and scroll myself?

Thanks
Steve



Mar 29 '06 #5
Steve,

I am not as diplotmatic about this as Stoitcho was. I think it was just a
huge screw up. When you set the maximum value in scroll bar you expect it
to reach the maximum. The fact that the help does not properly reflect what
is going on further suggests that it was stuff up:

More info here...
http://dotnetcoalface.blogspot.com/2...ggestions.html

Regards
Dave A

"Steve Barnett" <no****@nodomain.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I think I'm going nuts... Put a scroll bar control on a form and in the
form_load method, initialise it as follows:

vScrollBar.Minimum = 0;
vScrollBar.Maximum = 10;
vScrollBar.SmallChange = 1;
vScrollBar.LargeChange = 10;
vScrollBar.Value = 0;
vScrollBar.Visible = true;

In the vScrollBar_ValueChanged event, just display the current value of
the scroll bar. For example:
MessageBox.Show("Value: " + vScrollBar.Value);

When I run this, I expect to be able to click the arrow on the scroll bar
to scroll between 0 and 10. What I actually get is values between 0 and 1;
I am unable to scroll any further. I cannot get a value larger than 1.

Now, if I change the LargeChange value to 1, then everything works again.

Have I missed something fundamental about scroll bars here. I assumed that
I would be able to scroll (by the smallchange amount) from the minimum to
the maximum.

Any ideas? Do I have to intercept the "scroll" event and scroll myself?

Thanks
Steve

Mar 29 '06 #6
It works now and has become yet another piece of code surrounded by copious
comments explaining why I'm adding 'strange numbers' just to make it work
properly. This has to be, by far, one of the most unintuitive ways to code
that I have come across.

Still, having been bitten, I'll not get caught by this one again.

Thanks all
Steve

"Dave A" <da**@sigmasolutionsdonotspamme.com.au> wrote in message
news:Oy****************@TK2MSFTNGP11.phx.gbl...
Steve,

I am not as diplotmatic about this as Stoitcho was. I think it was just
a huge screw up. When you set the maximum value in scroll bar you expect
it to reach the maximum. The fact that the help does not properly reflect
what is going on further suggests that it was stuff up:

More info here...
http://dotnetcoalface.blogspot.com/2...ggestions.html

Regards
Dave A

"Steve Barnett" <no****@nodomain.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I think I'm going nuts... Put a scroll bar control on a form and in the
form_load method, initialise it as follows:

vScrollBar.Minimum = 0;
vScrollBar.Maximum = 10;
vScrollBar.SmallChange = 1;
vScrollBar.LargeChange = 10;
vScrollBar.Value = 0;
vScrollBar.Visible = true;

In the vScrollBar_ValueChanged event, just display the current value of
the scroll bar. For example:
MessageBox.Show("Value: " + vScrollBar.Value);

When I run this, I expect to be able to click the arrow on the scroll bar
to scroll between 0 and 10. What I actually get is values between 0 and
1; I am unable to scroll any further. I cannot get a value larger than 1.

Now, if I change the LargeChange value to 1, then everything works again.

Have I missed something fundamental about scroll bars here. I assumed
that I would be able to scroll (by the smallchange amount) from the
minimum to the maximum.

Any ideas? Do I have to intercept the "scroll" event and scroll myself?

Thanks
Steve


Mar 30 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3584
by: Askari | last post by:
Hi, I do a "perso"widget where have two scrolls (one vertical, one horizontal) for a canvas. When, the first time, I added widget in the canvas, the scroll self-ajust and when I move scrollbar,...
7
9591
by: Barbara de Zoete | last post by:
On one of my pages http://home.wanadoo.nl/b.de.zoete/html/tekeningen.html I have a div containing thumbnails (who ever came up with that word?) to select a larger view of a picture. The div is...
22
2329
by: Colin McGuire | last post by:
I apologize for posting yet another scrollbar question. Here is my code. All I want is for a diagonal line to appear from coordinates (0,0) to (width,height) in a usercontrol regardless of whether...
0
2593
by: d.steininger | last post by:
Hi there! Is there a way to bind a Textbox.Text to a ScrollBar.Value (not the Textbox-own Scrollbar) and vice versa? The Problem: I have to deal with two controls. The Textbox should accept...
2
8859
by: Paul_Madden via DotNetMonster.com | last post by:
I am handling the Listbox DrawItem event to enable the listbox strings to be displayed in different colours for easy reading. Have set ScrollAlwaysVisible and HorizontalScrollbar to true. I...
14
3932
by: Michael Weis | last post by:
Hello all, as a non-professional in these things, I searched for this topic but found no satisfying answer: I have to create a site with 3 frames. (Please no diskussion about the sense of...
2
2804
by: Ray | last post by:
Hi, would someone tell me how to make scrollbar work under grid? I think I'm missing something to connect scrollbar with the grid. following is some sample code. it shows the scrollbar, but it...
1
5305
by: Jenny | last post by:
Dear all, I have one select which lists one visible element. I want this select can show scrollbar after I click its down arrow, so that i can use the scrollbar to select the element i want. ...
3
3179
by: nicky77 | last post by:
Hi, before you say it i know frames are bad practice - but i'm developing dynamic content on a site which has already been designed, so alas there's no option but to use them. Anyway, I just want to...
1
13705
by: Tom | last post by:
First, I posted a similar request for help in another group and now don't find the posting. Problem with my newsreader perhaps ... but apologies if this appears as a cross posting. My code is...
0
7126
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6891
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7381
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5465
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4595
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3087
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1424
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
659
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
293
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.