i am building an applications that i would like to have a form with a tabcontrol on it.
what i would like to do is put 2 tabs on on which tab1 is a form that contains company details
and on tab to it contains a form that contains all related contacts. (there may be multiple contact for each company so need to be able to move through them.)
then within tab2 i am adding another tab control with 2 tabs one that dispalys a grid of all quotes and 2 that displays a grid of all orders
i have found out how to build the commands and fill a dataset but i don't know how to relate these reecords so that when the company changes the contact automatically change to related contact and the quote and orders then update to show only releated records to the current contact
how do i do this
my code so far is below
The data is actually all related in the sql database already if that makes any difference
Public Class Companies
Public ds As New DataSet
Private da As New SqlDataAdapter()
Private da1 As New SqlDataAdapter()
Private objCommand As New SqlCommand
Private objCommand1 As New SqlCommand
Public objDataView As DataView
Public objDataView1 As DataView
Public objCurrencyManager As CurrencyManager
Public objCurrencyManager1 As CurrencyManager
Private Sub Companies_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim objConnection As New SqlConnection(strConnection)
objCommand.Connection = objConnection
objCommand.CommandText = "sp_User_Companies"
objCommand.CommandType = CommandType.StoredProcedure
objCommand.Parameters.Add("@UserID", SqlDbType.Int, 2).Value = userID
da.SelectCommand = objCommand
objCommand1.Connection = objConnection
objCommand1.CommandText = "sp_User_Contacts"
objCommand1.CommandType = CommandType.StoredProcedure
objCommand1.Parameters.Add("@userID", SqlDbType.Int, 2).Value = userID
da1.SelectCommand = objCommand1
' Open the connection and execute the reader
Private Sub FillDataSetAndView()
ds.Relations.Add("PKID", ds.Tables.Item("companies").Columns("ID"), ds.Tables.Item("contacts").Columns("ID"), True)
' Set the DataView object to the DataSet object...
objDataView = New DataView(ds.Tables("companies"))
objDataView1 = New DataView(ds.Tables("contacts"))
' Set our CurrencyManager object to the DataView object...
objCurrencyManager = CType(Me.BindingContext(objDataView), CurrencyManager)
objCurrencyManager1 = CType(Me.BindingContext(objDataView1), CurrencyManager)