I have a bindingNavigator and some textboxes connected to the bindingsource, in a childform, a form inside another form.

I have a third form, a search function, and I need to change the bindingNavigator Position, when I choose a number in my "search" form.

I have some code in my "Search" Form, but I caannot get it to update the bindingnavigator in my child form:

Dim IndexNumber As Double = Me.TblMainVoyBindingSource.Find("ID", Me.TblMainVoyDataGridView.CurrentRow.Cells(0).Value)
frmEditVoyage.TblMainVoyBindingSource.Position = IndexNumber

The "frmEditVoyage" is located inside my Parent form "frmMain"
(The "Search" Form is not located inside any other forms)

I would appreciate any help


I found the solutionon this problem, I post it here if anyone else need it,
NB; I was searching the previous posts in this forum, and after a lot of trying and failing, I finally found the solution.

In the frmEditVoyage Form:

In the Public Class frmEditVoyage:

Inherits System.Windows.Forms.Form
    Dim F2 As New frmFindVoyage()

and in the button_Click event to open "Search" Form:

F2.ShowDialog(Me) ' Show the second form

        '  On return from the Modal Form (ie. When it has been closed)
        ' MsgBox("Current User : " & F2.usersname)

        Dim IndexNumber As Double = Me.TblMainVoyBindingSource.Find("ID", F2.usersname)
        Me.TblMainVoyBindingSource.Position = IndexNumber

And in my "Search" Form:
In the Public Class frmFindVoyage:

Inherits System.Windows.Forms.Form
    Public Shared NuNameTB As TextBox
    Public usersname As String

and in the button_Click event to "load" Change BindingNavigator position:
(When choosing from a datagrid)

usersname = Me.TblMainVoyDataGridView.CurrentRow.Cells(0).Value
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.