there he can modify the document he opened, and now i want to create a save button.
i did it for the save as button:
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
saveFileDialog1.FileName = sub;
if (DialogResult.OK == saveFileDialog1.ShowDialog())
{
string input = richTextBox1.Text;
using (Stream stream = saveFileDialog1.OpenFile())
{
using (StreamWriter writer = new StreamWriter(stream))
{
writer.Write(input);
}
}
MessageBox.Show("Saving the document was successful.");
}
but how can i create a "save" button, so that when he hits the button, he overwrites the document he opened with his doc.
and also for the save as button...how can i make it so that if the user opened a .txt file he will only be able to save the file he modifies with .txt, and this for every extension he gets. so that he is not able to modify the extension of the document. the saved document extension to be the same with the extension of the document he opened.
thx in advance
This post has been edited by Bocard: 17 June 2009 - 01:56 PM

New Topic/Question
Reply




MultiQuote



|