Solved

vb.net form position

Posted on 2006-07-17
3
2,105 Views
Last Modified: 2008-01-09
I am trying to set the position of a form, but it seems to pop up at a random place every time.

            SetParent(testProgram.Handle.ToInt32, Me.Handle.ToInt32)
            testProgram.Show()
            testProgram.Top = 100
            testProgram.Left = 100

or
            SetParent(testProgram.Handle.ToInt32, Me.Handle.ToInt32)
            testProgram.Show()
            testProgram.Top = me.top
            testProgram.Left = me.left +100

I also tried
           testProgram.Location = New Point(10,10)
0
Comment
Question by:jackjohnson44
  • 2
3 Comments
 
LVL 18

Expert Comment

by:Ravi Singh
ID: 17126333
Have you tried setting the forms StartPosition property to manual?

SetParent(testProgram.Handle.ToInt32, Me.Handle.ToInt32)
testProgram.StartPosition = FormStartPosition.Manual;
testProgram.Location = New Point(10,10)
testProgram.Show()
0
 
LVL 18

Expert Comment

by:Ravi Singh
ID: 17126338
sorry remove the semi colon after the second line
0
 
LVL 35

Accepted Solution

by:
YZlat earned 500 total points
ID: 17126411
did you try setting location before showing the form?


 testProgram.Top = 100
            testProgram.Left = 100

 testProgram.Show()
           
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

828 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