I´m writing a windows form application.

Consider this code:

if(openFileDialog1->ShowDialog() == System::Windows::Forms:ialogResult::OK)

{

System::IO::Path::GetDirectoryName(openFileDialog1->FileName);
MessageBox::Show(openFileDialog1->FileName, "Directory");

}

How can i store/write the result presenting in MessageBox to a file called "c:\path.txt",
instead of presenting the result in the MessageBox?

I would be eternally grateful for your help!