我试图将变量写入CSV文件中的一行,其中每个变量位于不同的单元格中。我的问题是,所有的变量都写入到同一个小区试图用“追加”和“AppendLine”不能把多个参数将多个变量写入一个CSV行
时,这是我的代码:
var NBSref = textBox3.Text;
var Lenght = textBox1.Text;
var Width = textBox2.Text;
string csvpath = "FILE LOCATION";
StringBuilder csvcontentNew = new StringBuilder();
csvcontentNew.Append(NBSref + Lenght + Width); // This is my issue
//String that will define CSV Location
File.AppendAllText(csvpath, csvcontentNew.ToString());
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
当我使用“追加”所有的变量数据插入到我的文件,但低于
This is what I get from my program
都在同一个小区看到,但是这是我想要的:
Ideally what my program would output