Results 1 to 8 of 8

Thread: Form and Service in the same Project?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    Form and Service in the same Project?

    Hi Guys,

    Noticed for the same Visual Studio Project you can go:

    Add new item > Windows Form
    also
    Add new item > Windows Service

    Can a single project have both Forms and Services? Installation of the assembly was successfully, but didn't have luck running it. I really wonder why Microsoft made it possible to add Forms and Services to the same project.

    Thanks,
    McoreD

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

    Re: Form and Service in the same Project?

    What version of VS? That sounds really weird. I thought that a service was a project in itself, because it gets compile to a single EXE. How can you then add a service to another project?
    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 GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479

    Re: Form and Service in the same Project?

    I think you may be confusing a Solution with a Project.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    Re: Form and Service in the same Project?

    Hi Guys, this is indeed weird. It's possible with both VS.NET 2003 and VS 2005.

    Attached here is a short video -- see what I mean?
    Attached Files Attached Files

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

    Re: Form and Service in the same Project?

    Weird and interesting, and weird too! I think I'm going to have to set some time aside to look into that.
    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

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    Re: Form and Service in the same Project?

    jmcilhinney, that's great. I was just dumbfounded with no clue what we can achieve from that feature/capability in Visual Studio.

    So many questions...
    how could a Windows Service (*.exe) and a Windows Form (*.exe) compile to a single exe?
    Does this mean we can have Windows Forms that can act like a Windows Service (if needed)??
    If not why did Microsoft add this ability in the first place??? I am sure you share those questions (and may be more too).

    Cheers, McoreD.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    Re: Form and Service in the same Project?

    It seems like Having Service and a Windows Forms GUI in the same EXE is possible! Hav a look at DynDNS Updater. They have implemented thsi sort of design. http://www.dyndns.com/support/clients/

  8. #8
    Fanatic Member
    Join Date
    May 2001
    Posts
    837

    Re: Form and Service in the same Project?

    I know a service is technically not supposed to have a user interface, correct? But...what if you happened to want to display a window when some event happens within the service. I think MSDE runs as a service but displays a tray icon to help manage itself. And the windows messenger service (the one for net send that everyone disables nowadays) displays a message box (not exactly a win form though). Point is, it's all just code so there's no reason to exclude certain code from an exe.
    The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.

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