예제 #1
0
        // Save() - Save file as existing format
        private void Save()
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.DefaultExt = "*.rtf";
            saveFileDialog.Filter     = "RTF Files|*.rtf";

            if (saveFileDialog.ShowDialog() == DialogResult.OK && saveFileDialog.FileName.Length > 0)
            {
                RichTB.SaveFile(saveFileDialog.FileName);
            }
        }
예제 #2
0
        // Allow Users to save the text file with new name.
        private void SaveAsFile()
        {
            SaveFileDialog saveFile = new SaveFileDialog();

            saveFile.Filter = "Rich Text File (*.rtf)| *.rtf";
            DialogResult dr = saveFile.ShowDialog();

            if (dr == DialogResult.OK)
            {
                RichTB.SaveFile(saveFile.FileName, RichTextBoxStreamType.RichText);
                currentFile = saveFile.FileName;
            }
            saved = true;
        }
예제 #3
0
 /* Allow users to Save the Text file.
  * Ask user to type filename if it's first time to save.
  * once user save as new name, user can override to existing file.
  */
 private void SaveFile()
 {
     if (currentFile == "")
     {
         SaveAsFile();
     }
     else
     {
         if (File.Exists(currentFile))
         {
             File.Delete(currentFile);
             RichTB.SaveFile(currentFile, RichTextBoxStreamType.RichText);
             saved = true;
             MessageBox.Show("File is succeessfully saved in " + currentFile + "! ", "Save", MessageBoxButtons.OK);
         }
         else
         {
             Testlabel.Text = "Error occured while saving the file.";
         }
     }
 }