Source code:
private void button1_Click(object sender, System.EventArgs e)
{
OpenFileDialog dlg=new OpenFileDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
string strPath = dlg.FileName;
MessageBox.Show(strPath);
}
}
private void button1_Click(object sender, System.EventArgs e)
{
OpenFileDialog dlg=new OpenFileDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
string strPath = dlg.FileName;
MessageBox.Show(strPath);
}
}
private void driveListBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
this.dirListBox1.Path=this.driveListBox1.Drive;
} private void button1_Click(object sender, System.EventArgs e)
{
this.filepath=this.dirListBox1.Path;
} public string FilePath
{
get{return this.filepath;}
set{this.filepath=value;}
}
我就是这么做的