Solved

vb.net form position

Posted on 2006-07-17
3
2,099 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

762 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

19 Experts available now in Live!

Get 1:1 Help Now