I have 1 tabcontrol with 2 tabpages, each tabpage with 1 datagridview (different tables for each), I load these 2 databases on the form load:

Me.AnndepTableAdapter.Fill(Me.HonorDataSet2.anndep)
 Me.SysdepTableAdapter.Fill(Me.HonorDataSet.sysdep)


  Dim sql1 As String
 Dim con1 As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\user\Desktop\honor.mdb")
        con1.Open()
        sql1 = "SELECT * FROM sysdep"

        Dim adapter1 As New OleDbDataAdapter(sql1, con1)

        Dim dt1 As New DataTable("sysdep")
        adapter1.Fill(dt1)

        DataGridView1.DataSource = dt1
        con1.Close()
       


        
        Dim sql2 As String
        Dim con2 As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\user\Desktop\honor.mdb")
        con2.Open()
        sql2 = "SELECT * FROM anndep"

        Dim adapter As New OleDbDataAdapter(sql2, con2)

        Dim dt2 As New DataTable("anndep")
        adapter.Fill(dt2)

        DataGridView2.DataSource = dt2
        con2.Close()

THE TABPAGE1 IS ALWAYS WORKING, SAME CODE ON THE TABPAGE2 IS NOT REALLY WORKING.

HOW DO YOU LOAD DIFFERENT DATABASES ON THE TABCONTROL? Thanks.

I have 1 tabcontrol with 2 tabpages, each tabpage with 1 datagridview (different tables for each), I load these 2 databases on the form load:

Me.AnndepTableAdapter.Fill(Me.HonorDataSet2.anndep)
 Me.SysdepTableAdapter.Fill(Me.HonorDataSet.sysdep)


  Dim sql1 As String
 Dim con1 As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\user\Desktop\honor.mdb")
        con1.Open()
        sql1 = "SELECT * FROM sysdep"

        Dim adapter1 As New OleDbDataAdapter(sql1, con1)

        Dim dt1 As New DataTable("sysdep")
        adapter1.Fill(dt1)

        DataGridView1.DataSource = dt1
        con1.Close()
       


        
        Dim sql2 As String
        Dim con2 As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\user\Desktop\honor.mdb")
        con2.Open()
        sql2 = "SELECT * FROM anndep"

        Dim adapter As New OleDbDataAdapter(sql2, con2)

        Dim dt2 As New DataTable("anndep")
        adapter.Fill(dt2)

        DataGridView2.DataSource = dt2
        con2.Close()

THE TABPAGE1 IS ALWAYS WORKING, SAME CODE ON THE TABPAGE2 IS NOT REALLY WORKING.

HOW DO YOU LOAD DIFFERENT DATABASES ON THE TABCONTROL? Thanks.

Actually, I found the problem, the way I load the databases were ok, I got the textbox.readonly = true to block the editing.

Be a part of the DaniWeb community

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