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

OpenFileDialog
EliasTa
srivathsan
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
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
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