Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Clear flygrid selections...

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Clear flygrid selections...
Link Posted: 03-Aug-2005 12:18
How do I clear all selection made to a flygrid.  I'm using the following code but it does not seem to work.


Me.flygrid.Selected.Items.Clear()


Could you please help.

Thanks in advance

Simon
Link Posted: 03-Aug-2005 13:13

VB.Net
Dim selection as Node() = Me.flygrid.Rows.SelectedNodes
If (Not selection is Nothing And selection.Length > 0) Then
Dim node as Node
For Each node In selection
    node.Selected = false
Next node
End If
Link Posted: 04-Aug-2005 08:27
Thanks for the code, unfortunately it is giving me the following error:

An unhandled exception of type 'System.InvalidCastException' occurred in ICAS.exe

Additional information: Specified cast is not valid.

On this line:


Dim selection As Node() = Me.flygrid1.Rows.SelectedNodes


Not quite sure why??

Thanks

Simon
Link Posted: 04-Aug-2005 11:27
Sorry for incorrect code:
Correct (root class of all types of nodes is NodeBase)

Dim selection As NodeBase() = Me.flygrid1.Rows.SelectedNodes
Link Posted: 04-Aug-2005 12:04
No problem, works perfectly now.

Thanks for the quick response, support from 9rays is second to none.

Simon