0
我有一個文本文件裏面有這些:c#datagrid使用字符「|」分割
test | 11 | 12 | 13 | 14 | 0
我正在製作一個帶有數據網格的程序,並且由於字符「|」而分割行時出現問題。有沒有人知道這個解決方案?我下面的代碼似乎並沒有工作。
foreach(string data in strArray)
{
string[] textData = System.IO.File.ReadAllLines(fName);
string[] storedData = strArray[0].Split("|");
for(int i=1; i < textData.Length; i++)
{
dataGridView1.Rows.Add(textData[i].Split(','));
dataGridView1.Rows.Add();
dataGridView1.Rows[i].Cells[0].Value = data;
j++;
}
}
即時得到錯誤「無法從‘字符串’轉換爲‘的char []’
感謝您的幫助
它的工作原理感謝你的幫助,你 –
可能標誌着我的回答是那麼的解決方案? – FrankPl