Results 1 to 2 of 2

Thread: Help in single form instantiation

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2009
    Posts
    135

    Help in single form instantiation

    hello There,

    I just like to know if how can i do single form instantiation upon loading my Form..upon loading my MainForm it automatically detect if that MainForm is still exist..ive try putting my code in the contructor of my MainForm..i check through the process in the task manager if that MainForm is still exist..but i think this is not the good idea bcoz..the MainForm takes several seconds to appear..and i think this is bcoz i loop through the process..

    hop u can help me.
    glen

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Help in single form instantiation

    If you can upgrade to VS 2005 or later then that functionality is provided with the check of a box in the project properties.

    In VS.NET 2003 it's a bit tricky. The simplest way is to call Process.GetProcessesByName to see if your process is already running and only call Application.Run if it's not, although that is not a 100% ideal solution.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width