it says that the path to the file is denied. looked for an hour no real answers. please help.
private void btnSetText_Click(object sender, EventArgs e)
{
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.InitialDirectory = Application.StartupPath;
dlg.Filter = "Text Document(*.txt)|*.txt|All Files(*.*)|*.*"; //https://stackoverflow.com/questions/48151581/system-argumentexception-filter-string-not-valid
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
txtSetText.Text = dlg.FileName;
}
}
System.IO.File.WriteAllText(txtSetText.Text , text);
every thing is fine and valid, but at the line:
System.IO.File.WriteAllText(txtSetText.Text , text);
I keep getting access to path xyz is denied. How do I make it accessable?