none
using MessageBox.Show from a console application RRS feed

  • Question

  • I wanted to use MessageBox.Show in a console application ( for debug purposes. ) I change the output type of the project from Console Application to Windows application. The project builds ok, but when I run it I no longer get the console window. The program is running, but there is no console window.

    What does output type console application do for a program?  Can I use MessageBox.Show from a console application?

    thanks,

     

    Tuesday, February 8, 2011 9:19 PM

Answers

  • change your project type back to console and...

    reference the System.Windows.Forms

    then you will be able to use

            System.Windows.Forms.MessageBox.Show("Test")


            'If you have the Imports or using statement (System.Windows.Forms)

            MessageBox.Show("Test") 'VB

            MessageBox
    .Show("Test"); //c#
    • Proposed as answer by Shane_B Tuesday, February 8, 2011 10:51 PM
    • Marked as answer by Steve Richter Wednesday, February 9, 2011 12:04 AM
    Tuesday, February 8, 2011 9:28 PM