Hey guys im working on some C# for the week The program i am making is a word processer. I have gotten it to save as a rich text file and i am using the savefile dialog. The extention is filld in by selecting the save file from a list. If i have only the one extention in the extentions selecton it works. if i have multiple ones however the extention does not fill in and you have to type it manualy.
This works:
This does not:
This works:
| Code: |
|
public void SaveMyFile() { SaveFileDialog saveFile1 = new SaveFileDialog(); saveFile1.DefaultExt = "*.rtf"; saveFile1.Filter = "RTF Files|*.rtf"; if(saveFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK && saveFile1.FileName.Length > 0) { textBox.SaveFile(saveFile1.FileName, RichTextBoxStreamType.PlainText); } } |
This does not:
| Code: |
|
public void SaveMyFile() { SaveFileDialog saveFile1 = new SaveFileDialog(); saveFile1.DefaultExt = "*.rtf"; saveFile1.Filter = "RTF Files|*.rtf"+ "HTML Files (*.htm)|*.htm|"; if(saveFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK && saveFile1.FileName.Length > 0) { textBox.SaveFile(saveFile1.FileName, RichTextBoxStreamType.PlainText); // I belive the above line is the problem but evry time i re write it it will not compile } } |
