I am trying to open a file which a user can set. In other words it will never be a set path or file. so when the user has selected the file they want to open this button below will open it. I have declared l1 and p1 as public strings.
public void button4_Click(object sender, EventArgs e)
{
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
l1 = Path.GetFileName(openFileDialog1.FileName);
p1 = System.IO.Path.GetDirectoryName(openFileDialog1.FileName);
}
public void button2_Click(object sender, EventArgs e)
{
//p1 = directory path for example "C:\\documents and settings\documents"
//l1 = filename
Process.Start(p1+l1);
}
So just to review I want to open up the file just using the directory path and filename. Is this possible? I can just have p1 there and it will open an explorer showing me that directory. Thank you for looking.