DelphiFAQ Home Search:
General :: Programming :: C++


Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

How can I display a file selection box with C++ in .NET?

You need to instantiate an object of the SaveFileDialog class. Prepare the file selection filter and then display the modal dialog with the ShowDialog() call.

The selected filename can be retrieved as the FileName member. You can also preset this member.

Alternatively you could drop such a component on your application's form and set the properties there.

Personally, I prefer to create this kind of object dynamically and get rid of it right away.

SaveFileDialog* saveFileDialog1 = new SaveFileDialog();
  
 saveFileDialog1->Filter = S"PEPCost files (*.pc)|*.pc|All files (*.*)|*.*"  ;
 saveFileDialog1->FilterIndex = 1;
 saveFileDialog1->RestoreDirectory = true;
  
 if(saveFileDialog1->ShowDialog() == DialogResult::OK) {
 
 // debugging message box
 	System::Windows::Forms::MessageBox::Show("Your PEPCost file will be saved.",
 		saveFileDialog1->FileName,
 		MessageBoxButtons::OK,
 		MessageBoxIcon::Information);
 }
 
 saveFileDialog1->Dispose();

Generated 0:01:20 on Nov 24, 2017