Results 1 to 5 of 5

Thread: [RESOLVED] Trying to set scrollbar position but it won't budge

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    South Charleston, WV, USA
    Posts
    607

    Resolved [RESOLVED] Trying to set scrollbar position but it won't budge

    I have a dynamically-created panel with a horizontal scrollbar which is created by placing controls outside of the panel. I want to set the scrollbar but it won't budge.

    Code:
    Me.Controls.Add(ReportPanel)
    ReportPanel.AutoScrollPosition = New Point(100, 0)
    ReportPanel.Visible = True
    Any ideas?

    I've tried rearranging these statements. I've been banging my head into a wall about this. For what it's worth the following
    Code:
    ReportPanel.HorizontalScroll.Value = 100
    does cause the scrollbar to move but the controls shift with it.

  2. #2
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,598

    Re: Trying to set scrollbar position but it won't budge

    Well, the purpose of the scroll bar is to move the controls, so if you change the thumb position, then the controls should move, so I'm not sure what you are trying to accomplish.

    If you want a scrollbar that you can move the thumb without moving the controls, then add a scrollbar to your panel.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    South Charleston, WV, USA
    Posts
    607

    Re: Trying to set scrollbar position but it won't budge

    Quote Originally Posted by passel View Post
    Well, the purpose of the scroll bar is to move the controls, so if you change the thumb position, then the controls should move, so I'm not sure what you are trying to accomplish.

    If you want a scrollbar that you can move the thumb without moving the controls, then add a scrollbar to your panel.
    I'm trying to scroll the panel with code. The panel has a scrollbar on it.

  4. #4
    Frenzied Member
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,158

    Re: Trying to set scrollbar position but it won't budge

    You can try using the 'ScrollControlIntoView' function..

    ReportPanel.ScrollControlIntoView(yourcontrol)

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    South Charleston, WV, USA
    Posts
    607

    Re: Trying to set scrollbar position but it won't budge

    I thought I had tried putting the ReportPanel.Visible = True statement before the other 2 statements. Apparently not. So I tried that and now it's working fine! Sorry for the trouble.

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