H
Hareth
How do I open a file (such as .txt) in C#.....
I tried:
String File;
File = txtMain.Text;
dlgOpen.ShowDialog();
File = dlgOpen.FileName;
using (StreamReader sr = new StreamReader(File))
sr.Read(dlgOpen.FileName); <- This line generated errors
\\\\\\\\\\\\\\\\\\
For saving a file I did...
string File;
File = txtMain.Text;
dlgSave.ShowDialog();
File = dlgSave.FileName;
using (StreamWriter sw = new StreamWriter(File))
sw.Write(txtMain.Text);
It worked, so I thought I could do the same for opening a file....Anyway,
anyone has any ideas?? thanks
I tried:
String File;
File = txtMain.Text;
dlgOpen.ShowDialog();
File = dlgOpen.FileName;
using (StreamReader sr = new StreamReader(File))
sr.Read(dlgOpen.FileName); <- This line generated errors
\\\\\\\\\\\\\\\\\\
For saving a file I did...
string File;
File = txtMain.Text;
dlgSave.ShowDialog();
File = dlgSave.FileName;
using (StreamWriter sw = new StreamWriter(File))
sw.Write(txtMain.Text);
It worked, so I thought I could do the same for opening a file....Anyway,
anyone has any ideas?? thanks