Results 1 to 3 of 3

Thread: [RESOLVED] [2008] HScroll Bar problem

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    Resolved [RESOLVED] [2008] HScroll Bar problem

    If I have the following code:

    HTML Code:
    Private Sub hsb_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles hsb.Scroll
    
            lblhsbValue.Text = hsb.Value
    
    End Sub
    and the properties are set to the default (Min is 0, max is 100, value is 0, Minjump is 1, maxjump is 10, etc etc), why is it that the label only shows the scroll bar's value to be 91 when the scroll bar is all the way to the right? Even if I click the > arrow button on the scroll bar, it stays at 91 as if 91 is it's max. Is there any reason for this, or a way to fix it?
    Last edited by Slyke; Nov 30th, 2008 at 06:04 AM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2008] HScroll Bar problem

    When the scroll bar is all the way to the right the Value will be equal to:

    Maximum - LargeChange + 1

    If you want the Value to equal the Maximum then you'd need to make the LargeChange equal to 1. If you don;t want the LargeChange to be 1 but you want the Value to be 100 when the scroll bar is all the way to the right then you must set the Maximum to:

    Value + LargeChange - 1

    If your maximum Value will be 100 and the LargeChange is the default 10 then that means your Maximum would need to be 109.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    Re: [2008] HScroll Bar problem

    Yep, that fixes it.

    I thought that because it only changes by 1 when I clicked the > button, that it could go past 91 since it would go to 92, which is still less then 100, but just have to live with it .

    Thanks for your help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width