Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi

i want to open a specifc folder clicking on open button and in that folder .XML extension file should be filter and show only and after than i can select any of the .xml file and load.

plase help on this..
i need thi in win form.
Posted

1 solution

C#
using System;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        // Show the dialog and get result.
        DialogResult result = openFileDialog1.ShowDialog();
        if (result == DialogResult.OK) // Test result.
        {
        }
        Console.WriteLine(result); // <-- For debugging use.
    }
    }
}




and in diaolog box filter property
Filter = "XML|*.xml"
 
Share this answer
 
Comments
rahuls1 11-Jul-13 4:53am    
i need to Open aspecific Folder eg TempFolder and when That TempFolder open it automaticall filter .XML file.
vinayakJJ 11-Jul-13 5:05am    
use initial directory property of dialog box and give the path of temp folder

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900