0
我想打開一個文本,其中我已經鍵入了很多字符串,並且在所有行之後 我想創建一個新行並將信息寫入所有信息 關於新行,我想寫我把它從文本框在現有文本的新行中添加一個新字符串
//button open file
private void button4_Click(object sender, EventArgs e)
{
if(openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
label7.Text = openFileDialog1.FileName;
textBox7.Text = File.ReadAllText(label7.Text);
}
}
//button save file
private void button5_Click(object sender, EventArgs e)
{
if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
File.WriteAllText(saveFileDialog1.FileName, textBox7.Text);
}
}
//this is the add button
private void button1_Click(object sender, EventArgs e)
{
string inValue1, inValue2, inValue3, inValue4, inValue5, inValue6;
inValue1 = textBox1.Text;
inValue2 = textBox2.Text;
inValue3 = textBox3.Text;
inValue4 = textBox4.Text;
inValue5 = textBox5.Text;
inValue6 = textBox6.Text;
string result = (inValue1 + "," + inValue2 + "," + inValue3 + ","
+inValue4+ "," +inValue5 + "," +inValue6);
//File.WriteAllText("C:\\text.txt", textBox1.Text);
System.IO.File.WriteAllText(@"C:\Users\v\Desktop\text.txt", result);
}