G
Guest
Hello
I am trying to open a text file, I use this code :
private: void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
Stream^ myStream;
OpenFileDialog^ openFileDialog1 = gcnew OpenFileDialog;
openFileDialog1->InitialDirectory = "c:\\";
openFileDialog1->Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
openFileDialog1->FilterIndex = 2;
openFileDialog1->RestoreDirectory = true;
if ( openFileDialog1->ShowDialog() == :ialogResult::OK )
{
if ( (myStream = openFileDialog1->OpenFile()) != nullptr )
{
myStream->Close();
}
}
}
The problem is that I obtain this error messages :
error C3083: 'DialogResult': the symbol to the left of a '::' must be a type
error C2039: 'OK' : is not a member of '`global namespace''
error C2065: 'OK' : undeclared identifier
All the errors are in this line :
if ( openFileDialog1->ShowDialog() == :ialogResult::OK )
Please help me
Thanks
I am trying to open a text file, I use this code :
private: void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
Stream^ myStream;
OpenFileDialog^ openFileDialog1 = gcnew OpenFileDialog;
openFileDialog1->InitialDirectory = "c:\\";
openFileDialog1->Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
openFileDialog1->FilterIndex = 2;
openFileDialog1->RestoreDirectory = true;
if ( openFileDialog1->ShowDialog() == :ialogResult::OK )
{
if ( (myStream = openFileDialog1->OpenFile()) != nullptr )
{
myStream->Close();
}
}
}
The problem is that I obtain this error messages :
error C3083: 'DialogResult': the symbol to the left of a '::' must be a type
error C2039: 'OK' : is not a member of '`global namespace''
error C2065: 'OK' : undeclared identifier
All the errors are in this line :
if ( openFileDialog1->ShowDialog() == :ialogResult::OK )
Please help me
Thanks