Very simple question about HScrollbar

S

Sahil Malik

I am making a user control.

It has a Hscrollbar,
and a label.

and I have a piece of code that links them together as -
private void hScrollBar1_Scroll(object sender,
System.Windows.Forms.ScrollEventArgs e)
{
label1.Text = hScrollBar1.Value.ToString() ;
}

(Also the relevant event handler) .... Sounds pretty simple huh?

Except, the Maximum Value of my scrollbar is 100, but the damn thing won't
scroll beyond 91.

Please help.

- Sahil Malik
Independent Consultant
You can reach me thru my blog - http://dotnetjunkies.com/WebLog/sahilmalik/
 
H

Herfried K. Wagner [MVP]

* "Sahil Malik said:
I am making a user control.

It has a Hscrollbar,
and a label.

and I have a piece of code that links them together as -
private void hScrollBar1_Scroll(object sender,
System.Windows.Forms.ScrollEventArgs e)
{
label1.Text = hScrollBar1.Value.ToString() ;
}

(Also the relevant event handler) .... Sounds pretty simple huh?

Except, the Maximum Value of my scrollbar is 100, but the damn thing won't
scroll beyond 91.

That's by design:

<URL:http://groups.google.com/groups?selm=CCWfEOXzCHA.1192@cpmsftngxa08>
 
S

Sahil Malik

When you think of "Maximum" do you think of "Maximum" or "Maximum -
LargeChange + 1". (Badly documented, this is mentioned in the fine print
only)
Also, the scrollbar in datagrids work different, they are "Maximum -
LargeChange". (Not documented at all).

So next time when you ask for a pitcher of beer, I will give you a pitcher
minus a glass plus a peg, but if you order your beer programatically, then
you get a full pitcher.

- Sahil Malik
Independent Consultant
You can reach me thru my blog at -
http://www.dotnetjunkies.com/weblog/sahilmalik/
 

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