use the button click event then type the following codes

opendialog dp= new opendialog.show();
dp.location=dp.flielocation

Recommended Answers

Use control flow to do your jobs. Like

If (dp.DialogResult=Windows.Forms.DialogResult.OK)
{
''''''''''''''''
''''Do Your Jobs''''''
''''''''''''''''
}
Jump to Post

All 2 Replies

Use control flow to do your jobs. Like

If (dp.DialogResult=Windows.Forms.DialogResult.OK)
{
''''''''''''''''
''''Do Your Jobs''''''
''''''''''''''''
}

You can use it like so

if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
    //use the OpenFileDialog as you like, you can get the
    //file name with "openFileDialog1.FileName;"    
}

That above assumes your OpenFileDialog is named "openFileDialog1". Just place that piece of code within the button's click event (that's usually how I do it)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.