[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 816
  • Last Modified:

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.
0
tsmolskow
Asked:
tsmolskow
  • 3
  • 3
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
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?
0
 
tsmolskowAuthor Commented:
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.
0
 
MsShadowCommented:
I think that is a control they designed themselves. Its not standard. The control is easy to design though...
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Mike TomlinsonMiddle School Assistant TeacherCommented:
You could Use a ListView control which allows you to assign Icons to the Items in it.
0
 
tsmolskowAuthor Commented:
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?
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
I'm not seeing any "New XXX" dialogs that have TreeViews in them (I'm using C# 2005 Express).   The closest is a ListView with the View() property set to "Large Icon".  The MS dialog has different "sections" in their window but I have no idea how to do that with the standard controls.

Can you find an Image on Google Images that you can post a link to?
0
 
tsmolskowAuthor Commented:
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
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now