Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6767831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:59:53+00:00 2026-05-26T14:59:53+00:00

Hey all I am trying to control the horizontal scroll of a panel box

  • 0

Hey all I am trying to control the horizontal scroll of a panel box in vb.net. The problem is that I can only seem to move it just a little bit using the following code:

Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
    panSS.HorizontalScroll.Value = HScrollBar1.Value
End Sub

The forms width is 800 while the panel itself stretches 1000+ (but only 800px are shown). I just don’t know how to go about using the HScrollBar to move it like it does if I had it on the auto-scroll feature.

Any help would be great.

Thanks!

David

update

Also tried doing this and the panel would not move at all:

Dim range = HScrollBar1.Maximum - HScrollBar1.LargeChange + HScrollBar1.SmallChange
Dim panelPos = (panSS.AutoScrollMinSize.Width - panSS.Width) * e.NewValue / range

    panSS.AutoScrollPosition = New Point(panelPos, 0)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:59:54+00:00Added an answer on May 26, 2026 at 2:59 pm

    Yes, doesn’t work because the panel’s scroll range is much larger than your scroll bar’s. You could fix it by setting the HScrollBar.Maximum value equal to the panel’s scroll width. Or use this code, it works regardless of the scroll ranges:

    Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As ScrollEventArgs) Handles HScrollBar1.Scroll
        Dim range = HScrollBar1.Maximum - HScrollBar1.LargeChange + HScrollBar1.SmallChange
        Dim panelPos = (Panel1.AutoScrollMinSize.Width - Panel1.Width) * e.NewValue / range
        Panel1.AutoScrollPosition = New Point(panelPos, 0)
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all, i have been trying for a few minutes on this problem and
Hey all, i have a problem with trying to get 2 forms to close
Hey All! I'm trying to construct a query that is something like this: Where
Hey all, my first post :D Problem: I'm trying to make a template gallery,
Hey All you out there, I am trying to write a query that sums
Hey all i am trying to use my already array that i populated into
Hey all i have an XML file that i am trying to loop though.
hey all, i been trying to make a class that uses a dictionary to
Hey all i am trying to find some code that would allow me to
Hey all, I'm trying to work on a simple script that takes a string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.