I'm trying to initiate 2 OpenFileDialog
in WinForms with two different buttons with the below code as shown:
OpenFileDialog openFileDialog = new OpenFileDialog();
if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string filePath = openFileDialog.FileName;
textPath.Text = filePath;
}
However, only the first button pops up with the window to select a file, and the second button, when clicked, does not pop up with the window to select a file. Any idea why? Thank you!
edit: I'm not wanting to display two dialogues at the same time, I just want two buttons that gets 2 different paths. The dialog is not showing up for me to select a file after clicking the second button, just after selecting a file using the dialog for the first button (dialog closes after that). Hope this clarifies, thanks!