Click here to Skip to main content
12,633,519 members (31,102 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# Silverlight
I need to save a textbox data in a .txt file in silverlight.But it seems to me writing to and reading data from a .txt file in silverlight isn't as same as i know in windows form.Moreover,i'm new in silverlight.This is what i tried..

private void buttonSave_Click(object sender, RoutedEventArgs e)
        {
            string birthday;

                MessageBoxResult result= MessageBox.Show("Your Birthday Saved Successfully","Confirmation",MessageBoxButton.OK);

                if (result == MessageBoxResult.OK)
                {
                    birthday = autoCompleteBox1.Text;
                    // create reader & open file
                    TextWriter tr = new StreamWriter(@"C:\" + "birthday.txt");

                    // read a line of text
                    tr.WriteLine(birthday);

                    // close the stream
                    tr.Close();
                }
        }


It don't create any file at all.So someone can provide a useful way to save record in a text file and read data from there in silverlight??
Posted 9-Aug-12 23:57pm
ridoy58.9K
Comments
Christian Amado 10-Aug-12 9:53am
   
Solutions help to you? Mark as answers if do it.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
ridoy 10-Aug-12 13:22pm
   
So it seems a text file cannot read or write without using open/saveFileDialog.Is it? I have no scope to use those dialog,i need to save that text file into a default drive and read from there when needed.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

  Permalink  
Comments
ridoy 11-Jan-13 15:31pm
   
Ok,upvoted..:),but i did that without using fileDialog which was my requirement.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161208.2 | Last Updated 11 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100