Click here to Skip to main content
15,938,446 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Comments
Christian Amado 10-Aug-12 9:53am    
Solutions help to you? Mark as answers if do it.

1 solution

 
Share this answer
 
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.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900