OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "All Files (*.*)|*.*"; dialog.Multiselect = false; if (dialog.ShowDialog() == true) { txtKeyPath.Text = dialog.FileName; }