Results 1 to 4 of 4

Thread: Run Program In Background?

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    14

    Question Run Program In Background?

    Hey

    I want to make a program to run in background but keep its icon in the taskbar and when user clicks on the icon it will show the program?

    Thanks :]

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

    Re: Run Program In Background?

    When you say:
    keep its icon in the taskbar
    do you actually mean the big button on the task bar or the little icon in the system tray, i.e. beside the clock? If you mean the system tray then you just add a NotifyIcon to your form, set its Icon property and make it Visible. You can then Hide and Show the form at will.
    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

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    14

    Unhappy Re: Run Program In Background?

    Quote Originally Posted by jmcilhinney
    When you say:do you actually mean the big button on the task bar or the little icon in the system tray, i.e. beside the clock? If you mean the system tray then you just add a NotifyIcon to your form, set its Icon property and make it Visible. You can then Hide and Show the form at will.
    I Yes System Tray next to the clock.

    I tried adding a NotifyIcon to the form and I added Me.hide() but that didnt work form still showed?

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

    Re: Run Program In Background?

    That would be because you called Me.Hide before the form was shown. You can't hide something that hasn't been shown and if it gets shown after you call Hide then calling Hide is pointless.

    If you don't want a form to be displayed when your app is started up then you need to set its WindowState to Minimized and its ShowInTaskbar to False. The form will then not be seen by the user but it is still, strictly speaking, visible. You then handle the Shown event of the form, which is raised AFTER the form has been shown, and call Hide there. Now the form will be truly not visible.
    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