Home>

I'm programming C # using csc.exe.
I compiled the code that opens the file dialog with csc.exe as shown below.
However, I don't get an error when compiling, but I can't open the file dialog.

It will be in the "no response" state.

Strangelydialog.ShowHelp = true;If i specify, a dialog will open.

How can I avoid the "no response" condition?

using System;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Text;
namespace TestFileIO
{
class Form1: Form
{
    public class WinMain: Form {
        public static void Main () {
            Application.EnableVisualStyles ();
            Application.Run (new WinMain ());
        }
        public WinMain () {
            this.Text = "Title";
            MainMenu mm = new MainMenu ();
            MenuItem [] mi = {
                new MenuItem ("Save as ... (&A)", new EventHandler (save as)),
            };
            mm.MenuItems.Add ("File (&F)", mi);
            Menu = mm;
        }
        private void saveas (object sender, System.EventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog ();
            You can run it by typing //dialog.ShowHelp = true;
            dialog.Filter = "AllFiles | *. *";
            DialogResult rest = dialog.ShowDialog ();
            if (rest == DialogResult.OK)
            {
                //abridgement
            }
        }
    }
}
}


By the way, the compilation is as follows.

csc file.cs


* I did not find it even after doing a Google search.