Solved

Position VScrollbar on a Form contained in a TabControl

Posted on 2009-04-06
2
233 Views
Last Modified: 2013-12-26
I need my forms vscrollbar to be at the top position.
I'm creating a new form at runtime on a new tab (tabcontrol).  My tablelayoutpanel vscrollbar is at the top position, but my forms vscrollbar position  is all the way down to expose the bottom most portion of the form.  My code:

        MyForm = New PDF_ML_Form
        MyForm.FormBorderStyle = Windows.Forms.FormBorderStyle.None
        MyForm.Dock = DockStyle.None
        MyForm.TopLevel = False
        MyForm.Anchor = AnchorStyles.Left
        MyForm.Anchor = AnchorStyles.Top
        MyForm.AutoScrollPosition = New Point(1, 1)
        Dim s As Int16 = MyForm.Width
        MyForm.Location = New Point((s - Val(PDF_ML_Form.PDF_ML_Cust_Name_txt.Text)) / 2 - 800, 4)
        MyForm.Anchor = AnchorStyles.Left
        ' Set location & size of main tab container
        MyForm.Size = New Size(MyForm.Width, PDF_ML_Form.Height + 80)
        MyForm.AutoScrollPosition = New Point(1, 1)
        myTabPage.Controls.Add(MyForm)
Thank You
0
Comment
Question by:GarySB
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 125 total points
ID: 24079486
Try setting the AutoScrollPosition back to (0, 0) in the SHOWN() event of the Form:


Public Class YourFormHere
 

    Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown

        Me.AutoScrollPosition = New Point(0, 0)

    End Sub
 

End Class

Open in new window

0
 

Author Comment

by:GarySB
ID: 24080125
Its not changing the top and this is to small of a thing to take up your time with.  I'm removing the form vscrollbar and making my tablelayoutpanel smaller so it fits on a form without the need for a scroll.  Thank You
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now