public ref class form : public System::Windows::Forms::Form
{
public:
form(void)
{
InitializeComponent();
void save(String^ word);
}
//windows form generated code
...
...
...
void save(String^ word)
{
StreamWriter^ outFile = gcnew StreamWriter("file.txt");
outFile->WriteLine(word);
outFile->Close();
}
#pragma endregion
private:
System::Void button00_Click(System::Object^ sender, System::EventArgs^ e)
{
String^ word = "PLOW";
save(word);
}
};
}
答案 0 :(得分:1)
StreamWriter驻留在命名空间System :: IO中,并在mscorlib.dll中实现。只需添加一行
即可 using namespace System::IO
导入您的代码文件,您就可以开始了。