Answer the question
In order to leave comments, you need to log in
How to call open file dialog?
From some recent time
private void button1_Click(object sender, EventArgs e)
{
FileDialog.ShowDialog();
}
The current thread must be set to a single-threaded container (STA) thread for OLE calls to be possible.
private delegate DialogResult ShowSaveFileDialogInvoker();
private void button1_Click(object sender, EventArgs e)
{
ShowSaveFileDialogInvoker invoker = new ShowSaveFileDialogInvoker(FileDialog.ShowDialog);
this.Invoke(invoker); // where this is a Form
}
Answer the question
In order to leave comments, you need to log in
Try:
var fileDialog = new OpenFileDialog();
if(fileDialog.ShowDialog()==DialogResult.OK) { //code }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question