I you want litle change
string filename=txtfilename.text;
string path = System.IO.Path.Combine(@"E:\Majel\Tic Tac Toe\TextFiles\", filename + ".txt");
File.Create(path);
you try also
string filename = textBox1.text;
string path = System.IO.Path.Combine(@"E:\", filename + ".txt");
System.IO.FileInfo file = new System.IO.FileInfo(path);
file.Create();
if (File.Exists(path))
{
TextWriter tw = new StreamWriter(path, true);
tw.WriteLine("The next line!");
tw.Close();
}
filename =string.Empty;
textBox1.text=string.Empty;
try this
string filename = txtfilename.text;
string path = System.IO.Path.Combine(@"D:\", filename + ".txt");
FileStream fs = new FileStream(path, FileMode.OpenOrCreate);
StreamWriter str = new StreamWriter(fs);
str.BaseStream.Seek(0, SeekOrigin.End);
str.Write("mytext.txt.........................");
str.WriteLine(DateTime.Now.ToLongTimeString() + " " +
DateTime.Now.ToLongDateString());
string addtext = "this line is added" + Environment.NewLine;
str.Flush();
str.Close();
fs.Close();