我有一个包含12列的datagridview。当我尝试使用下面的代码从DataGridView派生新的DataGridViewRow时,row.Cells计数为0。
可以从DataGridView派生一个新行,所以我不必以编程方式添加列。我已经设计了列,我不想再为每一行手动添加它们。
谢谢, 苏珊
For Each rowSQL As MyDataSet.GetStudentRow In Me._CurrentOrder.GetStudents.Rows
Dim row As DataGridViewRow = Me.dgDetails.RowTemplate
For Each cell As DataGridViewCell In row.Cells
Dim aa As String = cell.Value.ToString
Next
Next
答案 0 :(得分:1)
Dim row As New DataGridViewRow
row.CreateCells(Me.dgDetails)