[C ++]'文件':不是类或命名空间名称

时间:2016-08-06 05:43:49

标签: visual-c++

INCLUDE and USINGS
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 System::Xml;
using namespace System::Diagnostics; 

我正在尝试创建一个filemover项目。我在Youtube上播放了一段视频。这个youtuber可以使用这个代码,但我不能。我收到此错误:'文件':不是类或命名空间名称。enter code here

#pragma endregion
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
            OpenFileDialog^ openFileDialog1 = gcnew OpenFileDialog;
            openFileDialog1->ShowDialog();
            textBox1->Text = openFileDialog1->FileName;
         }
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
             OpenFileDialog^ openFileDialog1 = gcnew OpenFileDialog;
                openFileDialog1->ShowDialog();
                textBox2->Text = openFileDialog1->FileName;
         }
private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
         File::Move(textBox1->Text,textBox2->Text);
         MessageBox::Show("Succes");
     }
};

错误

  

(138):错误C2653:'文件':不是类或命名空间名称   (138):错误C3728:'event System :: EventHandler ^ System :: Windows :: Forms :: Control :: Move':event没有raise方法   ==========构建:0成功,1个失败,0个最新,0个跳过==========

1 个答案:

答案 0 :(得分:0)

文件位于System :: IO中,因此您也应该使用此程序集。