Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Automatically select row in list from another list...

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

Automatically select row in list from another list...
Link Posted: 22-Jan-2007 02:17
I have 2 lists one called lstResults and one called lstComm. Both rows have a column call commID.  What I want to do is when I select a row from the lstResults list I want to also select the same row in the lstComm list.

The numbers in the commID columns will be the same and are unique.

Please could you give me an example of how to do this, preferably in vb.net.

Also I would like the row in the lstComm list to be in focus if it is not visible in the list.

Thanks in advance

Simon
Link Posted: 22-Jan-2007 11:24
1. Handle NodeSelectedChanged event to handle node selection in the first list.
2. In this handler please analyze node provided on Selected property:

if (node.Selected)
{
  //lists synchronization procedure
}

3. Search the synchronized list for the related to selected in the first list node.
4. set FlyGrid.Selected property to the founded node in the synxhornized list.
Link Posted: 22-Jan-2007 14:27
I have done the following which works find apart from it will not select my nested item, could you please explain what I have done wrong? I am using virtual grid.


findComm(Me.lstResults.Selected.Item(0).ToString)



    Private Sub findComm(ByVal ID As String)
        Dim items As NodeCollection = Me.lstReviewComm.Rows.Items
        Dim item As NodeBase
        For Each item In items
            If item.Item(0).ToString = ID Then
                Me.lstReviewComm.Selected = item
                Exit Sub
            End If
        Next
    End Sub


Thanks in advance

Simon
Link Posted: 23-Jan-2007 06:42
Hmm, code seems correct.
Please debug your code to make sure that the node has been successfully found and selected.