the code is below:
OpenFileDialog fDialog = new OpenFileDialog();
fDialog.Title = "Select script to load...";
fDialog.Filter = "Text Files|*.txt";
fDialog.ShowDialog();
string text = File.ReadAllText(Path.GetFullPath(fDialog.FileName));
if (text.Length > 0)
{
LuaCArea.Text = text;
}
I get the error:
The path is not of a legal form.
Any ideas?
Just wait for the OpenFileDialog
result dud and don't use Path.GetFullPath
OpenFileDialog fDialog = new OpenFileDialog();
fDialog.Title = "Select script to load...";
fDialog.Filter = "Text Files|*.txt";
if(fDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
LuaCArea.Text = File.ReadAllText(fDialog.FileName);
}