Share via

Type GridViewRow is not defined vb.net

Mohamed El-Sayed Maghraby 21 Reputation points
2021-07-03T07:57:44.597+00:00

I want to group datagridview columns, So I've found this code but it give me error:

"Type GridViewRow is not defined"

What's wrong there?

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
Developer technologies | VB
0 comments No comments

Answer accepted by question author

Viorel 127K Reputation points
2021-07-03T08:16:42.493+00:00

According to documentation, GridViewRow is for Web application. If you are developing a desktop application (Forms), then consider the DataGridViewRow class.

However, this control does not seem to include span features. Maybe you should consider some alternatives: https://www.bing.com/search?q=DataGridView+span, or describe your problem.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.