Click here to Skip to main content
Rate this: bad
good
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 22:57pm
ridoy51.2K
Comments
Christian Amado at 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 at 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 at 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
0 OriginalGriff 278
1 Nguyen.H.H.Dang 230
2 Maciej Los 205
3 Peter Leow 195
4 arvind mepani 187


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