Solved

Position VScrollbar on a Form contained in a TabControl

Posted on 2009-04-06
2
238 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

738 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