Results 1 to 10 of 10

Thread: [RESOLVED] In console applications, can't use Messagebox class why???

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2003
    Posts
    436

    Resolved [RESOLVED] In console applications, can't use Messagebox class why???

    I can't use Messagebox class in console app's.


    why so?

    nath
    Last edited by Hack; Apr 18th, 2006 at 10:41 AM. Reason: Added [RESOLVED] to thread title and green "resolved" checkmark

  2. #2
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: In console applications, can't use Messagebox class why???

    MessageBox is a class inside of System.Windows.Forms. Since console apps don't have this referenced in the template, you need to do it manually in order to use them.

    ---Sorry for deleting. I just wanted to test it and make sure there wasn't something I missed. :P

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

    Re: In console applications, can't use Messagebox class why???

    You shouldn't be using MessageBoxes in a console app. Console apps don't have a GUI and the MessageBox class is a GUI element.
    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

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2003
    Posts
    436

    Re: In console applications, can't use Messagebox class why???

    thanks much

    nath

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: In console applications, can't use Messagebox class why???

    If this is resolved, you can help other forums members by please pulling down the Thread Tools menu and click the Mark Thread Resolved button. That will let everyone know that you have your answer.

    Thank you.

  6. #6
    Hyperactive Member umilmi81's Avatar
    Join Date
    Sep 2005
    Location
    Sterling Heights, Mi.
    Posts
    335

    Re: In console applications, can't use Messagebox class why???

    Quote Originally Posted by jmcilhinney
    You shouldn't be using MessageBoxes in a console app.
    Says who?

  7. #7
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: [RESOLVED] In console applications, can't use Messagebox class why???

    The common-sense fairy, thats who

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

    Re: In console applications, can't use Messagebox class why???

    Quote Originally Posted by umilmi81
    Says who?
    The whole point of a console app is that it uses the console to interact with the user. What's wrong with Console.WriteLine to give the user a message? Also, what happens if someone tries to automate your console app by redirecting the standard streams? How's that going to handle a MessageBox?
    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

  9. #9
    Fanatic Member popskie's Avatar
    Join Date
    Jul 2005
    Location
    In my chair
    Posts
    666

    Re: [RESOLVED] In console applications, can't use Messagebox class why???

    If u want to use the messagebox in console app. U can add referrence the System.Windows.Forms.dll.

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2003
    Posts
    436

    Re: [RESOLVED] In console applications, can't use Messagebox class why???

    Quote Originally Posted by popskie
    If u want to use the messagebox in console app. U can add referrence the System.Windows.Forms.dll.
    wonderful site.

    thanks
    nath

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