private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.Title = "Open a file to process";
//selectable file types
openFileDialog1.Filter = "Portable Document Format (*.pdf)|*.pdf|Text Documents(*.txt)|*.txt";
openFileDialog1.InitialDirectory = "c:\";
DialogResult respo= openFileDialog1.ShowDialog();
if (respo == DialogResult.OK)
{
textBox1.Text = openFileDialog1.FileName;
}
else
{
textBox1.Text = "No selected file!";
}
}
Showing posts with label FileOpenDialog. Show all posts
Showing posts with label FileOpenDialog. Show all posts
Friday, February 3, 2012
Using FileOpen Dialog
Labels:
C#.net,
FileOpenDialog,
Filter
Subscribe to:
Posts (Atom)