Link to home
Start Free TrialLog in
Avatar of tsmolskow
tsmolskow

asked on

C# New File Dialog

I want to create a new file dialog box in C#, I'v tried this but it doesn't work:

               OpenFileDialog MyOpen=new OpenFileDialog();
               MyOpen.CheckPathExists=false;
               MyOpen.CheckFileExists=false;
              MyOpen.ShowDialog();

Please include code sample.
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

It works fine for me:

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog MyOpen = new OpenFileDialog();
            MyOpen.CheckPathExists = false;
            MyOpen.CheckFileExists = false;
            if (MyOpen.ShowDialog() == DialogResult.OK)
            {
                String fileName = MyOpen.FileName;
                MessageBox.Show(fileName, "You selected:", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
                MessageBox.Show("No Selection", "Dialog Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

Could you define "but it doesn't work" in a little more detail?
Avatar of tsmolskow
tsmolskow

ASKER

I want it to behave like the New File dialog in VS 2005 which presents you a set of file types/templates to choose from.
I think that is a control they designed themselves. Its not standard. The control is easy to design though...
You could Use a ListView control which allows you to assign Icons to the Items in it.
OK, so if the dialog is not standard then what's the best control to make it with?  Idle Mind you mentioned list view, but is the control to the left just s tree view, and what is the control on the bottom?
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'll look, but even if it matched the add new item dialog that would be cool, and that should be the same in express as it is in VS 2005