[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.
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.
Re: Trying to set scrollbar position but it won't budge
Quote:
Originally Posted by
passel
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.
Re: Trying to set scrollbar position but it won't budge
You can try using the 'ScrollControlIntoView' function..
ReportPanel.ScrollControlIntoView(yourcontrol)
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.