Problem with Devexpress

  • Thread starter den ryko via .NET 247
  • Start date
D

den ryko via .NET 247

Hello to all.
Please let me know how to define grid view.
When I put following code in to the application file the error ?Type 'GridView' is not defined? persists all the time. Please help me



'Deletes selected data and group rows
Public Sub DeleteSelectedRows(ByVal view As GridView)
'Create a list containing selected row handles
Dim selRowsCount As Integer = view.SelectedRowsCount
If selRowsCount = 0 Then Return
Dim selRows As ArrayList = New ArrayList(view.GetSelectedRows())
'Process selected group rows and add their child data rows to the list
Dim i As Integer
For i = 0 To selRowsCount - 1
getChildRowHandles(view, CType(selRows(i), Integer), selRows)
Next

'Copy list elements to an array
Dim selRowsArray(selRows.Count - 1) As Integer
For i = 0 To selRowsArray.Length - 1
selRowsArray(i) = CType(selRows(i), Integer)
Next
'Sort the array
Array.Sort(selRowsArray)

'Prevent excessive visual updates while deleting
view.BeginUpdate()
Try
'Delete rows starting from the last element
For i = selRowsArray.Length - 1 To 0 Step -1
view.DeleteRow(selRowsArray(i))
Next
view.ClearSelection()
Finally
view.EndUpdate()
End Try
End Sub


'Returns handles of child data rows for the given group row
Public Sub getChildRowHandles(ByVal view As GridView, ByVal groupRowHandle As Integer, ByVal childRowHandles As ArrayList)
If Not view.IsGroupRow(groupRowHandle) Then Return
'Get the number of immediate children
Dim childCount As Integer = view.GetChildRowCount(groupRowHandle)
Dim i As Integer
For i = 0 To childCount - 1
'Get the handle of a child row with the required index
Dim childHandle As Integer = view.GetChildRowHandle(groupRowHandle, i)
'If the child is a group row, then add its children to the list
If view.IsGroupRow(childHandle) Then
getChildRowHandles(view, childHandle, childRowHandles)
Else
'The child is a data row. Add it's handle to childRowHandles providing that the handle was not added before
If Not childRowHandles.Contains(childHandle) Then childRowHandles.Add(childHandle)
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top