Results 1 to 5 of 5

Thread: [2005] One Instance

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Posts
    182

    Thumbs up [2005] One Instance

    How would I only allow one instance of the application running at one time on a computer??

    Thanks!

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

    Re: [2005] One Instance

    Go to the Application tab of the project properties and tick the appropriate box.
    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

  3. #3
    Hyperactive Member cptHotkeys's Avatar
    Join Date
    Apr 2007
    Location
    New Zealand
    Posts
    294

    Re: [2005] One Instance

    I know the method mentioned above is better;
    (If this even works) will declaring a form "Shared" prevent multiple instances, or just force changes made on one to occur on the other aswell?

    Signatures suck

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

    Re: [2005] One Instance

    The 'Shared' key word has nothing to do with single instances, plus you cannot declare a class Shared in VB.NET. The C# equivalent of 'Shared' is 'static' and you can declare a class static in C#, but the VB.NET equivalent of a static class is a module.

    The 'Shared' key word is applied to members to indicate that they are members of the class itself rather than any particular instance. It's not correct to say that Shared members affect all instances of a class. It's correct to say that Shared members affect no instances of the class. They affect the class itself.
    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

  5. #5
    Hyperactive Member cptHotkeys's Avatar
    Join Date
    Apr 2007
    Location
    New Zealand
    Posts
    294

    Re: [2005] One Instance

    ahh, got it...
    So that wouldnt work...
    And so rather than declaring a class shared, you would declare an instace of it shared, which is what I knew but just needed to clarify, and thanks for mentioning the C# thing, I often wrapped my head around that when trying to convert code and never got it...

    Signatures suck

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