I am back asking for help. Please help me.
I am trying to use OpenFileDialog control to display specific files with .XML extension and prompt the users to select only file with extension .XML
Apparently I don't know how to only display specific files with .XML on the FileDialog display screen. Instead it display all the files kept in the Folder. It's causing confusion to the users as the folder contained more than 540 files.
Here are my coding that is not displaying only specific files with .XML extension
Expand|Select|Wrap|Line Numbers
- String strFileNameNPath
- private void btnTemplate_Click(object sender, EventArgs e)
- {
- //create an OpenfleDialog
- System.Windows.Forms.OpenFileDialog dlgOpen = new System.Windows.Forms.OpenFileDialog();
- //set properties for dlgOpen
- dlgOpen.Title = "Select XML File ;
- dlgOpen.ShowReadOnly = true;
- dlgOpen.Multiselect = false;
- //display the dialog and return results
- if (dlgOpen.ShowDialog() == DialogResult.OK)
- {
- strFileNameNPath = dlgOpen.FileName;
- this.txtTemplate.Text = strFileNameNPath;
- }
- Else
- {
- messagebox.show(“Your cancel XML selection”)
- }
- }
Thank you for helping me. Yaaa.....Hooo.......
Have a Good Day,
Cheers,
Lennie