?
Solved

SaveFileDialog (Silverlight 4) - Filter

Posted on 2011-03-15
4
Medium Priority
?
985 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

770 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