Results 1 to 3 of 3

Thread: End Program from a Sub not in Use by the Form

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    New York
    Posts
    94

    End Program from a Sub not in Use by the Form

    How do I unload a project from anywhere? I've tried every way I can think but none work. I'm trying to unload from a notifyicon.
    AZURE
    Act 1: Ruby
    Act 2: Cavara Militari
    Act 3:
    Act 4:
    Act 5: Cogito ergo sum

  2. #2
    PowerPoster sunburnt's Avatar
    Join Date
    Feb 2001
    Location
    Boulder, Colorado
    Posts
    1,403

    Re: End Program from a Sub not in Use by the Form

    The best way would be to close your main form.

    Alternatively, you can call
    Code:
    System.Windows.Forms.Application.Exit()
    Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.

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

    Re: End Program from a Sub not in Use by the Form

    Is your NotifyIcon a member of the startup form? If so it would just be a matter of calling this.Close() from whatever event you choose to handle. Normally you would attach a ContextMenu or ContextMenuStrip (please specify your version in future) to the NotifyIcon with an Exit item, then handle the Click event of that menu item. If your Notifyicon is not a member of your startup form then you call Application.Exit as sunburnt suggested. Just note that no Closing or Clsed events will be raised on your forms in this case. In C# 2.0 the FormClosing and FormClosed events will be raised though.
    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