I am trying to save some information entered into a text box to a file. This is what i have, but I keep getting the error that follows. I tried changing it to myStream->Write(tp) but that doesn't work either. Help Please!!
private: System::Void button3_Click(System::Object * sender, System::EventArgs * e)
SaveFileDialog* saveFileDialog1 = new SaveFileDialog();
saveFileDialog1->Filter = S"txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
saveFileDialog1->FilterIndex = 2 ;
saveFileDialog1->RestoreDirectory = true ;
if(saveFileDialog1->ShowDialog() == DialogResult::OK)
if((myStream = saveFileDialog1->OpenFile()) != NULL)
// Code to write the stream goes here.
String *tp = this->OutputBox->ToString();