Add BindingNavigator for DataGridView

To add a BindingNavigator for a DataGridView, even when there’s no DataSource like DataSet or DataTable in use, you can have DataGridView’s rows collection as DataSource for BindingSource.
And set that BindingSource to BindingSource property of BindingNavigator.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles MyBase.Load

        BindingSource2.DataSource = DataGridView1.Rows
        BindingNavigator1.BindingSource = BindingSource2

        'instead of adding event handler for MoveFirst,MoveLast,MoveNext,MovePrevious
        'chose this one. it will fire anyway
        AddHandler BindingNavigatorPositionItem.TextChanged, AddressOf bindingnavigator_PostionChanged

    End Sub

Continue reading