2
我是C#中的新成員,目前正在開發一個Windows Mobile應用程序,在該應用程序中,我必須在按鈕的單擊事件上創建文本文件,並且必須編寫存在的文本字段的值在任何人都可以幫我解決這個問題,我正在使用visual 2008。在C#中爲Windows Mobile App創建文本文件
private void btnSubmit_Click(object sender, EventArgs e)
{
string path = "C:\\Users\\Mytext.txt";
if (!File.Exists(path))
{
File.Create(path);
TextWriter tw = new StreamWriter(path);
tw.WriteLine("The very first line!");
tw.Close();
}
else if (File.Exists(path))
{
TextWriter tw = new StreamWriter(path);
tw.WriteLine("The next line!");
tw.Close();
}
}
之前,您應該使用本地存儲對於這一點,有沒有'C'開車去。 –
這不是關於Windows Phone應用程序,因爲用戶使用VS2008。 – josef