首页 > 解决方案 > 类型 GridViewRow 未定义 vb.net

问题描述

我想对 datagridview 列进行分组,所以我找到了这段代码,但它给了我错误:

“未定义类型 GridViewRow”

那里有什么问题?

Protected Sub OnDataBound(sender As Object, e As EventArgs)
    For i As Integer = SearchInvoiceDGV.Rows.Count - 1 To 1 Step -1
        Dim row As GridViewRow = SearchInvoiceDGV.Rows(i)
        Dim previousRow As GridViewRow = SearchInvoiceDGV.Rows(i - 1)
        For j As Integer = 0 To row.Cells.Count - 1
            If row.Cells(j).Text = previousRow.Cells(j).Text Then
                If previousRow.Cells(j).RowSpan = 0 Then
                    If row.Cells(j).RowSpan = 0 Then
                        previousRow.Cells(j).RowSpan += 2
                    Else
                        previousRow.Cells(j).RowSpan = row.Cells(j).RowSpan + 1
                    End If
                    row.Cells(j).Visible = False
                End If
            End If
        Next
    Next
End Sub

标签: vb.nettypesdatagridviewgroupingdefined

解决方案


推荐阅读