Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Changing the top row from within TopRowChanged

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

Changing the top row from within TopRowChanged
Link Posted: 17-Jul-2006 07:47
Hi,

I need to change the top row in the TopRowChanged event.  For testing purposes, I set it to always go to row index #10.

However, this gets completely ignored.

Here is my code.  I omit the virtual mode methods, but all they do is map data from the datatable exactly.

Since I am handling the TopRowChanged event, I expect the top row to always be 10, as soon as there is any scrolling, or the top row changes by any other method.

However, when I click the scroll button, the grid just scrolls normally.

When it should go right down to row index 10, and then stay there no matter where else I try to scroll.
[VB.Net]
Private dt As New DataTable
    Private inTopRowChange As Boolean = False

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        dt.Columns.Add(\"Col1\")
        dt.Columns.Add(\"Col2\")

        For i As Integer = 0 To 40
            dt.Rows.Add(New Object() {i, \"Row \" & i})
        Next

        grid.Columns.Items.Add(New Column(\"Col1\"))
        grid.Columns.Items.Add(New Column(\"Col2\"))
        grid.Rows.VirtualMode = True
    End Sub

    Private Sub grid_TopRowChange(ByVal sender As Object) Handles grid.TopRowChange
        If inTopRowChange Then Return
        inTopRowChange = True
        grid.ActivePort.TopRow = 10
        inTopRowChange = False
    End Sub
Link Posted: 23-Jul-2006 19:26
This problem will solved to the nearest FlyGrid.Net update.