Solved

Position VScrollbar on a Form contained in a TabControl

Posted on 2009-04-06
2
235 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

856 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