Hello,
i don't know how to delete all selected rows in the grid? I have done the following for one row but it does not seem to work when i do it for multiple rows. can you help me?
Public Sub DeleteRowFromGrid(ByVal dg As FlyGrid, ByVal obj As Object)
Dim currentRow As Integer
dg.BeginInit()
Dim node As NodeBase = dg.Selected
If Not node Is Nothing Then
currentRow = node.Index
Dim dr As DataRowView = CType(node.Value, DataRowView)
If Not dr Is Nothing Then dr.Delete()
If TypeOf (obj) Is DataSet Then
DirectCast(obj, DataSet).AcceptChanges()
ElseIf TypeOf (obj) Is DataTable Then
DirectCast(obj, DataTable).AcceptChanges()
Else
Exit Sub
End If
End If
dg.EndInit()
Dim newFocused As Integer
If currentRow -1 And currentRow < dg.ActivePort.RowCount Then
newFocused = currentRow
Else
newFocused = dg.ActivePort.RowCount - 1
End If
If dg.Rows.Items.Count > 0 Then dg.Selected = dg.ActivePort.Rows.Items(newFocused)
End Try
End Sub