How to link between parent and child form ?

meho2021

New member
Joined
Mar 9, 2021
Messages
3
Programming Experience
10+
Dear All

I want to link between Parent Form with controls and Child Form as a data grid view , I made the SQL connections, the problem is when I navigate the parent form the child form does not navigate with it , Here is the code

VB.NET:
Private BS1 As New BindingSource
         Private BS2 As New BindingSource

        Dim dsMain, dsSub As New DataSet
        databaseconnection()
        Dim SqlMain = "SELECT * FROM tbl_Tenders_Main"
        Dim daMain = New SqlDataAdapter(SqlMain, connection)
        daMain.Fill(dsMain, "Main")
        BS1.DataSource = dsMain.Tables("Main")
        txt_TenderNo.DataBindings.Add("Text", BS1, "TenderNo")
        BindingNavigator1.BindingSource = BS1

        Dim SqlSub = "SELECT * FROM tbl_Tenders_Sub INNER JOIN tbl_Tenders_Main ON tbl_Tenders_Sub.TenderNo =
        tbl_Tenders_Main.TenderNo"
        Dim daSub = New SqlDataAdapter(SqlSub, connection)
        daSub.Fill(dsSub, "Sub")
        BS2.DataSource = dsSub.Tables("Sub")
        DataGridView1.DataSource = BS2
        connectionclose()

What should I do to link between the navigator and the child to navigate with the parent together.

Thanks, Regards
 
Last edited by a moderator:
Are you really talking about two separate forms because there's nothing in that code that suggests that you are? Do you just mean parent/child data in the one form, displayed in two separate sets of controls? Do you mean that the parent data is displayed in a set of discrete controls and, when you select a parent record, the children of that record are displayed in a grid?
 

Latest posts

Back
Top