Autoscroll bar position changes when publishing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • VBNewbie2008
    New Member
    • Nov 2016
    • 4

    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!
  • IronRazer
    New Member
    • Jan 2013
    • 83

    #2
    Try setting the AutoScrollPosit ion to 0,0 in the Form.Shown event.
    Code:
        Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
            Me.AutoScrollPosition = New Point(0, 0)
        End Sub

    Comment

    • VBNewbie2008
      New Member
      • Nov 2016
      • 4

      #3
      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.wheelscro lllines property, and it was not.

      Comment

      • VBNewbie2008
        New Member
        • Nov 2016
        • 4

        #4
        IronRazer,

        I just realized that it didn't work because I tried using "Me.AutoScrollP osition" after I rebuilt the form with the panel. After changing "Me.AutoScrollP osition" to "Panel1.AutoScr ollPosition", it worked. Thank you!

        Comment

        Working...