0
У меня есть быстрый вопрос, как вы сохраните файл в другом формате, как и в «сохранить как»Как сохранить файл в другом формате?
до сих пор я получил это
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
//this saves the file as a text or richtext.
saveFileDialog1.Filter = ("RichText*.rtf;)|*.rtf; |TextDocs *.txt;|*.txt");
saveFileDialog1.FilterIndex = 2;
//this gives the title of the savefiledialog.
saveFileDialog1.Title = "save file";
//this prompts the user if they want to overwrite an existing file.
saveFileDialog1.OverwritePrompt = true;
//gets the input made by the savefiledialog.
if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
//saves the file.
richTextBox1.SaveFile(saveFileDialog1.FileName,
//saves the text in the richbox
RichTextBoxStreamType.RichText);
Я хочу, чтобы иметь возможность сохранить как эфир а rtf или txt. Благодарю.
Можете ли вы привести мне пример, я все еще не знаком с C#. – mendez
укажите другое имя файла вместо переменной saveFileDialog1.FileName, когда вы выполните операцию сохранения. – Zenwalker
спасибо, я понял! Я просто не могу поверить, что это было так просто: P – mendez