470,601 Members | 1,513 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,601 developers. It's quick & easy.

Autoscroll bar position changes when publishing

Hello all,

I am creating a windows application and have several controls inside the main form. One of these controls is a TabControl, and it should be able to extend below the visible area of the form. I set the AutoScroll property to True on the main form, and it correctly adds a scroll bar that can show the entire height of the Tab Control. However, when I publish this project to a .exe, the main form shows up with the automatic scroll bar in the middle of the scrollable range (not exactly the middle, but somewhere below the top).

Can anybody help me fix this? I can't seem to get anywhere because I don't know how to call a value from an AutoScroll Bar. Thanks in advance!
Nov 3 '16 #1

✓ answered by IronRazer

Try setting the AutoScrollPosition to 0,0 in the Form.Shown event.
Expand|Select|Wrap|Line Numbers
  1.     Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
  2.         Me.AutoScrollPosition = New Point(0, 0)
  3.     End Sub

3 972
83 64KB
Try setting the AutoScrollPosition to 0,0 in the Form.Shown event.
Expand|Select|Wrap|Line Numbers
  1.     Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
  2.         Me.AutoScrollPosition = New Point(0, 0)
  3.     End Sub
Nov 3 '16 #2
Hi IronRazer,

Thank you for your reply, but this did not fix my issue. Upon hitting "Start Debugging", the main form that pops up is still not at the uppermost autoscroll position. I did some more playing, and here is some other information that may help:

I rebuilt the form and, instead of placing controls inside of the form that had the autoscroll property set to true, I used a panel that filled the entire form and set the panel autoscroll property to true. However, the same issue presented itself. On both builds, it seems that the application thinks that my TabControl control needs to be in focus (the control was at the very top of the visible area in the form). I tried giving focus to another control which is at the top with no success. I also researched into whether the amount of autoscroll was equal to the number of lines moved with the mouse wheel, using the mouse.wheelscrolllines property, and it was not.
Nov 4 '16 #3

I just realized that it didn't work because I tried using "Me.AutoScrollPosition" after I rebuilt the form with the panel. After changing "Me.AutoScrollPosition" to "Panel1.AutoScrollPosition", it worked. Thank you!
Nov 4 '16 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Ben Fidge | last post: by
5 posts views Thread by JC | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.