title: panel scrolling programmable
body: <p>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:</p>
  
  <pre><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
  </code></pre>
  
  <p>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.</p>
  
  <p>Any help would be great.</p>
  
  <p>Thanks!</p>
  
  <p>David</p>
  
  <p><strong>update</strong></p>
  
  <p>Also tried doing this and the panel would not move at all:</p>
  
  <pre><code>Dim range = HScrollBar1.Maximum - HScrollBar1.LargeChange + HScrollBar1.SmallChange
  Dim panelPos = (panSS.AutoScrollMinSize.Width - panSS.Width) * e.NewValue / range
  
      panSS.AutoScrollPosition = New Point(panelPos, 0)
  </code></pre>