积极答复者
datagridview column问题

问题
-
For Each line As String In lines
Dim rowIndex As Integer = Me.DataGridView1.Rows.Add
Dim words As String() = line.Split({" "c}, StringSplitOptions.RemoveEmptyEntries)
Dim i As Integer = 0
For Each word As String In wordsMe.DataGridView1.Rows(rowIndex).Cells(i).Value = word
i += 1
Next
Next我写了以个代码是吧richtextbox1的数字全部导入到datagridview1.如下:
a b c d e100 200 300 400
250 300 400 500
但是我想要从第二行(b)到(e)开始导入第一行保留(a),我的代码该怎样修改?
a b c d e100 200 300 400
250 300 400 500
答案
-
i从1(第二列)开始:
Dim i As Integer = 1 For Each word As String In words Me.DataGridView1.Rows(rowIndex).Cells(i).Value = word i += 1 Next
- 已标记为答案 letsbarter 2012年2月17日 3:03
全部回复
-
i从1(第二列)开始:
Dim i As Integer = 1 For Each word As String In words Me.DataGridView1.Rows(rowIndex).Cells(i).Value = word i += 1 Next
- 已标记为答案 letsbarter 2012年2月17日 3:03