[Solved] How to create a .txt file using c#? [closed]


Try this, if you want to save username password in the same file

string fileName = textBox1.Text + ".txt"; 
System.IO.File.WriteAllText(@"C:\\Users\\User\\Documents\\1ClickData\\ID\\" + fileName, "Username="+textBox1.Text+" Password="+textBox2.Text);

or if you want to save username and password in separate file

    //for username
    string fileName1 = textBox1.Text + ".txt"; 
    System.IO.File.WriteAllText(@"C:\\Users\\User\\Documents\\1ClickData\\ID\\" + fileName1, textBox1.Text);

    //for password
    string fileName2 = textBox2.Text + ".txt"; 
    System.IO.File.WriteAllText(@"C:\\Users\\User\\Documents\\1ClickData\\ID\\" + fileName2, textBox2.Text);

6

solved How to create a .txt file using c#? [closed]