title: Undeclared Identifier related to string variable
body: <p>I am new to programming when I tried to run below code (I pasted only essential parts) I got error error : 
  C2065: 'myfilename' : undeclared identifier</p>
  
  <pre><code>#pragma once
  #include &lt;string&gt;
  namespace First_App {
  
  using namespace System;
  using namespace System::ComponentModel;
  using namespace System::Collections;
  using namespace System::Windows::Forms;
  using namespace System::Data;
  using namespace System::Drawing;
  using namespace MySql::Data::MySqlClient;
  using namespace System::IO;
  using namespace std;
  
  // other events while clicking buttons etc . 
  
  private: System::Void button1_Click_1(System::Object^  sender, System::EventArgs^  e) {
  
           Stream^ myStream;
           OpenFileDialog^ OpenFiledialogVariable1 = gcnew OpenFileDialog();
           if (OpenFiledialogVariable1-&gt;ShowDialog()==System::Windows::Forms::DialogResult::OK)
           {
           if ((myStream = OpenFiledialogVariable1-&gt;OpenFile()) != nullptr)
  
               String^ myfilename = OpenFiledialogVariable1-&gt;InitialDirectory + OpenFiledialogVariable1-&gt;FileName;
               MessageBox::Show(myfilename); // ERROR shown in this line
               myStream-&gt;Close();
  
           }
  
       }
  </code></pre>
  
  <p>I tried ans searched msdn docs, google nothing related found. I think I did  include required header file for string class but still doesnt work. Appreciate any help. </p>