+ 2

Error With SaveFileDialog And StreamReader? (C#)

I have A error,I want the streamwriter to write that textlines into the savefiledialog file path (savefiledialog.filename), It doesnt mark me any error,but when my app runs and I try to save the file,my app stops and say "Exception Unhandled. System.ArgumentException. CanÂŽt leave void the name of file path"

25th Apr 2018, 1:12 AM
SebGM2018
SebGM2018 - avatar
2 Answers
+ 2
This Is My Code SaveFileDialog savefiledialog1=new SaveFileDialog(){ Filter="Analytica Files|*.analy",AddExtension=true};if (savefiledialog1.ShowDialog()== DialogResult.OK){using(Stream s= File.Open(savefiledialog1.FileName, FileMode.CreateNew)) using((s)){ var path= saveFileDialog1.FileName; TaskData.file=new StreamWriter(path); TaskData.File.Write(TitleBox.Text;)
25th Apr 2018, 1:12 AM
SebGM2018
SebGM2018 - avatar
+ 1
c# is case sensitive SaveFileDialog savefiledialog1=new SaveFileDialog() var path= saveFileDialog1.FileName; savefiledialog1 is not saveFileDialog1
25th Apr 2018, 7:34 AM
sneeze
sneeze - avatar