Select the file and click OK to display the absolute path of the file in the text box.
public void getfilepath()
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "Arbitrary files (*. *)|*. *"; //type and description of the file
if (dlg.ShowDialog() == DialogResult.OK) //After the selection is made
{
string filePath = dlg.FileName;
textBox1.Text = filePath;
}
}