I'm using an OpenFileDialog to let the user chose a file to open. it works, but if I chose a file and insted of pressing OK I press CANCEL it still opens the file because I picked up one.
I found this code in the MSDN, but I can't see ::DialogResult::OK in my apllication
if ( openFileDialog1->ShowDialog() == ::DialogResult::OK )
{
if ( (myStream = openFileDialog1->OpenFile()) != nullptr )
{
// Insert code to read the stream here.
myStream->Close();
}
}
my code is:
fileD1->ShowDialog();
while(!fileD->FileName->Lenght!=0)
{
}
and here I open the file
any other idea of how to know which button I pressed? I'm using c++ and visual studio 2008
save the return of this ->> openFileDialog1->ShowDialog()
into a value and then check the value
DialogResult::OK
or
DialogResult::CANCEL