Code:
private: System::Void saveToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
SaveFileDialog^ dig = gcnew SaveFileDialog();
dig->Filter = "TextFiles|*.txt";
if(dig->ShowDialog() == Windows::Forms::DialogResult::OK)
{
System::IO::File::WriteAllText(dig->FileName, m_WriteLine->Text);
}
}
private: System::Void openToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
OpenFileDialog^ dig = gcnew OpenFileDialog();
dig->Filter = "TextFiles|*.txt";
if(dig->ShowDialog() == System::Windows::Forms::DialogResult::OK)
{
m_WriteLine->Text = IO::File::ReadAllText(dig->FileName);
}
}
I have this code to make a file/save/open button for my textbox but when i compiled i got errors (if needed i can post) I think its something wrong with my code. Please let me know.