?
Solved

SaveFileDialog (Silverlight 4) - Filter

Posted on 2011-03-15
4
Medium Priority
?
990 Views
Last Modified: 2013-11-12
I´m using filter in SaveFileDialog, but it not appear when I show the dialog box.
What is wrong?

Thanks.



  private void btnDownload_Click(object sender, System.Windows.RoutedEventArgs e)

        {
            SaveFileDialog saveDialog = new SaveFileDialog();
            saveDialog = new SaveFileDialog();

            saveDialog.DefaultExt = ".txt";
            saveDialog.Filter = "Text Files|*.txt|Log Files|*.log|All Files|*.*";
            saveDialog.FilterIndex = 2;  


            if (saveDialog.ShowDialog() == true)
            {
                System.IO.Stream fileStream = saveDialog.OpenFile();
                System.IO.StreamWriter sw = new System.IO.StreamWriter(fileStream);
                sw.Write(Retorno);
                sw.Flush();
                sw.Close();
            }
        }
Image1.jpg
0
Comment
Question by:Plexo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
lenordiste earned 1000 total points
ID: 35142768
your code looks fine. I tested it and it does show all 3 filter types. Can you try running your code on another PC and see if the problem still occurs?
0
 
LVL 3

Assisted Solution

by:politex
politex earned 1000 total points
ID: 35146755
it's works, you are sure what filter's string at page exact as in your code, possible anything symbol was eaten by parser?
0
 

Author Comment

by:Plexo
ID: 35169057
The problem was in my computer.
Thanks for the help.

In Time..

Is there the possibility of a default file name in Dialog box too?
0
 
LVL 3

Expert Comment

by:politex
ID: 35171441
I think this is denied, because insecure.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question