Solved

Position VScrollbar on a Form contained in a TabControl

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

760 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

20 Experts available now in Live!

Get 1:1 Help Now