[Mono-winforms-list] Possible problem in 2.2 with file dialogs

Alex Corrado alex at centroidcafe.com
Fri Nov 28 22:20:23 EST 2008


It looks like you need to do "Text files (*.txt)|*.txt|All files (*.*)| 
*.*"

Note the asterisk before the .txt extension.

Cheers!

-Alex

On Nov 28, 2008, at 9:42 AM, Paul wrote:

> Hi,
>
> I have a very simple OpenFileDialog method which filters filetypes.  
> Only
> problem, it's not working. I'm not sure if it's me or mono - I've only
> done this once or twice before (I don't normally give people the  
> choice
> of the file to load ;-p), so I'm not going to guess the error...
>
> private void BrowseButton_Click(object sender, EventArgs e)
> {
> 	OpenFileDialog fdlg = new OpenFileDialog();
> 	fdlg.Title = "Open File Dialog";
> 	fdlg.InitialDirectory = @"C:\ ";
> 	fdlg.Filter = "Text files (*.txt)|.txt|All files (*.*)|*.*";
> 	fdlg.FilterIndex = 1;
> 	fdlg.RestoreDirectory = true;
> 	if (fdlg.ShowDialog() == DialogResult.OK)
> 	{
> 		textBox1.Text = fdlg.FileName;
> 	}
> }
>
> Show all files works, but .txt doesn't.
>
> Is this me or mono?
>
> TTFN
>
> Paul
> -- 
> Sie können mich aufreizen und wirklich heiß machen!
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list



More information about the Mono-winforms-list mailing list