在datagridview中需要两个单词之间的空格
问题描述:
我正在合并一个网格中的两个列值 - 它很好但是,我希望两个单词之间有一个空格(单个空格)。有人可以帮我这个吗?
以下是我的代码:
I'm merging two column values in a grid - it's coming good but, i want a space (single space) between two words. can anyone please help me on this?
Below is my code:
int rowadded = 0;
for (int RowCount = 1; RowCount <= strfile.Length - 1; RowCount++)
{
if (strfile[RowCount].ToString() != " ")
{
if (RowCount != 0)
{
//dataGridView1.Rows.Add();
string[] column = strfile[RowCount].Split('þ');
rowadded = 0;
for (int i = 1; i < column.Length - 1; i++)
{
//dataGridView1.Rows.Add();
if ((cmbColumn1.SelectedIndex == ((i - 1) / 2)) || (cmbColumn2.SelectedIndex == ((i - 1) / 2)))
{
if (rowadded == 0)
{
rowadded = 1;
dataGridView1.Rows.Add();
}
if (column[i].ToString() != "\u0014")
{
dataGridView1.Rows[RowCount - 1].Cells[cmbColumn1.Text].Value += column[i].ToString();
}
}
}
我尝试了什么:
我尝试在行中添加++但它不起作用。
What I have tried:
I tried adding + " " + in the line but it didn't work.
答
dataGridView1.Rows[RowCount - 1].Cells[cmbColumn1.Text].Value += " " + column[i].ToString();