在Silverlight中编写和读取文本文件 [英] Write and Read a text file in Silverlight
本文介绍了在Silverlight中编写和读取文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将一个文本框数据保存在silverlight的.txt文件中。但是在我看来,写入和从Silverlight中的.txt文件中读取数据并不像我在Windows窗体中所知的那样。此外,我是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();
}
}
根本不创建任何文件。所以有人可以提供一种有用的方法来保存文本文件中的记录并从silverlight中读取数据吗?
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??
推荐答案
如何在Silverlight中读写文件 [ ^ ]
在Silverlight中读取和写入文本文件 [ ^ ]
SL写入和读取文本文件 [ ^ ]
在SL中读取和写入本地文件 [ ^ ]
How to read and write files in Silverlight [^]
Read and Write Text files in Silverlight[^]
SL write and read textfile[^]
Reading and writing local files in SL[^]
这篇关于在Silverlight中编写和读取文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文