You have to call the ShowDialog method after you instantiate your
openFile
object.
private void bomNameFld_Click(object sender, EventArgs e)
{
OpenFileDialog openFile = new OpenFileDialog();
if( openFile.ShowDialog() == DialogResult.OK )
{
string file = openFile.FileName;
bomNameFld.Text = file;
}
}
Also, you should check the Boolean result returned from the call to ShowDialog. If the user clicks OK, then True is returned. If the user clicks Cancel, then False is returned.
See
OpenFileDialog.ShowDialog Method[
^]