use the button click event then type the following codes

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

Recommended Answers

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.