Windows Positioning

Posted on 2005-05-12
Last Modified: 2010-04-23
I need to add a button to a WinForm in VB.NET 2003 so that when the user clicks it at any time, that window will be centered on the screen.

Any ideas?
Question by:SETP
    LVL 19

    Accepted Solution

    on the button click just write this



    Author Comment

    Thanks! As a matter of interest, I checked the MSDN help on this method and this is what it says:

    This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
    LVL 19

    Expert Comment

    Thanks for that bit SETP
    so its a function that the Framework uses
    Now the point is why they say "not intended to be used directly"
    I mean what's the harm

    if not for this single call you'd have had to write a sizeable amount of code to achieve the same result...

    Author Comment

    I completely agree with you. All I know is that that code works perfectly for me and that's all that matters! :)

    Thanks arif_eqbal

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    This video discusses moving either the default database or any database to a new volume.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    745 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

    14 Experts available now in Live!

    Get 1:1 Help Now