Nevron Diagram
Skip Navigation Links
Home
Forum Home
Latest 50
Unanswered
Win Prizes
All Time Leaders
Jump to CategoryExpand Jump to Category
Login 
    Welcome Guest!
 Search Forum For :  
X
 Login
Please login to submit a new post, reply and edit exiting posts, see user profiles, and access more features. If you are not a registered member, Register here.
User Id / Email:
Password:  
Forgot Password | Forgot UserName
   Home » Effective VB.NET » (Solved/Void) Form Start location will not update/renew after changing form size
       
Post is Closed.
Author Reply
Damien O Neill
posted 4 posts
since Nov 04, 2007 
from

(Solved/Void) Form Start location will not update/renew after changing form size

  Posted on: 22 Jan 2012       
Hi All, never thought I would be the one posting a question but this one is baffling me.

I set the form startup location to centre on my 2nd monitor (dual) last week.

This week I increased the form height to add more function but the form insists on its starting location being that of the old form.

Both Monitors are 1280 x 1024

The code for setting the location is as follows:

 Dim screen As Screen

  screen = screen.AllScreens(1)

  Me.StartPosition = FormStartPosition.Manual

  Me.Location = New System.Drawing.Point((((1280 / 2) - (Me.Width / 2)) + 1280), ((1280 / 2) - (Me.Height / 2)))


This worked just fine before I changed the form height.  However, once the form size changed, the location did not update as it should have with the x,y co-ordinates still acting as if the form was the old size.

I also tried to change the location manually by entering in the exact x,y values but the form starts in the correct location and then a split second later moves back to the old incorrect location.

Is there something I am not doing to flush the old values?


Damien O Neill
posted  4 posts
since  Nov 04, 2007 
from 

 Re: Form Start location will not update/renew after changing form size
  Posted on: 23 Jan 2012        0  
No edit option. Additional info: I am on Windows 7 32bit and use Visual Studio 2005.
Vulpes
posted  5390 posts
since  Feb 28, 2011 
from 

 Re: Form Start location will not update/renew after changing form size
  Posted on: 23 Jan 2012        0  
What happens if you use:

Me.StartPosition = FormStartPosition.CenterScreen

rather than centering the form manually?
Damien O Neill
posted  4 posts
since  Nov 04, 2007 
from 

 Re: Form Start location will not update/renew after changing form size
  Posted on: 23 Jan 2012        0  
Tried that one, again it starts in the correct (center screen) position but after a split second it reverts back to the old incorrect position.

I'm away from the PC at the moment but I'd nearly create a new form and copy over all objects and code to see if that one works.
Damien O Neill
posted  4 posts
since  Nov 04, 2007 
from 

 Re: Form Start location will not update/renew after changing form size
  Posted on: 23 Jan 2012        0  
Feel like a tard. Must have been sitting in front of the screen for too long. Got home and fixed the problem within a minute of looking at it! Had put bit of code in the 'form closing' event of another form a long time ago and forgotten all about it. Was setting the new form to open in the closing form's location. Initially both forms were the same size so problem only surfaced when I changed the size of one of them. Duh! Sorry to waste your time guys.
       
6 Months Free & No Setup Fees ASP.NET Hosting!
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
6 Months Free & No Setup Fees ASP.NET Hosting!
 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Site Map  |  Advertise with us
Current Version: 5.2011.3.12
 © 1999 - 2012  Mindcracker LLC. All Rights Reserved