OpenFileDialog

I have this code that I want to put in my project but I do not know exactly where to put it or how to complete it, if someone could please help me with this

CommonDialog.Flags = OFN_FILEMUSTEXIST + OFN_HIDEREADONLY + OFN_ALLOWMULTISELECT

CommonDialog.DialogTitle = "Select Map"

CommonDialog.Filter = "Map Files (*.map)|*.map|All Files(*.*)|*.*"

CommonDialog.FilterIndex = 2

CommonDialog.CancelError = True

CommonDialog.Action = DLG_FILE_OPEN




Answer this question

OpenFileDialog

  • EliasTa

    Sniper, I think you need to start from first principles - and take a beginner tutorial or so - what are you trying to do
  • srivathsan

     Sniper167 wrote:
    Thank You, it's about time someone understood what I mean't!

    For someone "asking" for help, I think a response in the same day is quite good.  And with responses like that, you sure won't be getting any help from me or anyone who works for me.


  • Wei Wang father of twins

    Thank You, it's about time someone understood what I mean't!

  • Karthik Mohan

    Not to defend the tone, but as an extreme beginner, he asked the same question in this thread three days earlier

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=187793&SiteID=1

    so that's what he probably meant.  As a beginner he probably didn't realize that asking the same question in two separate threads is considered bad form.

     


  • aviatordave

    Thank You Ted!

  • edworkerkcmsd

    Ok, it appears you are trying to program in C++/CLI (managed using .NET Framework).  Follow these steps:

    1) Create a new project: Visual C++ - CLR - Windows Forms Application

    2) A blank form should pop up on screen.

    3) Click on the toolbox, and click on common controls, then button.

    4) Now click on the blank form and place a button.

    5) Double click on the button.

    6) Now copy and paste the following code into your handler (i.e. just below the System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) { )  :

       //we use OpenFileDialog to show a file-open dialog box
       OpenFileDialog CommonDialog;
       CommonDialog.Title = "Select Map";

       CommonDialog.Multiselect = true;
       CommonDialog.CheckFileExists = true;
       CommonDialog.Filter = "Map Files (*.map)|*.map|All Files(*.*)|*.*";
       CommonDialog.FilterIndex = 2;

       //if user has clicked on the OK button
       if(CommonDialog.ShowDialog()== System::Windows::Forms::DialogResult::OK)
       {  // do something here 
       }

    7) Compile your application, and run it.

    8) Press the button.

    9) Now your OpenFileDialog will appear!


  • ogtr

    Im new at this and I'm just trying to make an Open File Window that will allow me to open a .map file on my computer and then when I select it it will appear in my OpenFileDialog that I have on my program. And trust me, I've tryed to take a tutorial but nobody has one in Visual C++ Express 2005 they're all in VC 3.0 or VC 6.0 which is really old! If you know of a tutorial in Visual C++ Express Edition, let me in on it.

  • OpenFileDialog