By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,009 Members | 1,767 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,009 IT Pros & Developers. It's quick & easy.

Autoscroll bar position changes when publishing

P: 4
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
  4.  

Share this Question
Share on Google+
3 Replies


IronRazer
P: 82
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
  4.  
Nov 3 '16 #2

P: 4
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

P: 4
IronRazer,

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.