[RESOLVED] [2005] Databinding Help Parent Child
Hi,
I have used the following code to fill a dataset and bind a number of textboxes to a table in the dataset through a bindingsource which I placed on the form.
However I also have a datagrid on the form which I want to bind to one of the child tables in the dataset. I want the bindingsource to handle the currency manager. What I dont understand is how to apply this. Do I need to alter the code below or create another binding source and somehow link to the first binding source?
VB Code:
objApplicantCollection = New ApplicantCollection 'Not an actual Collection class just used for dataset level operations
objDataConnection = New DataConnection 'Used for making calls to the database
objApplicantCollection.FillApplicants() 'Call sub in class which fills public dataset via dataconnection class
Me.bsrcApplicants.DataSource = objDataConnection.ddsApplicantCollection 'Set datasource of bindingsource
Me.txtApplicantID.DataBindings.Add("Text", Me.bsrcApplicants, "PK_ApplicantID")
Me.txtTitle.DataBindings.Add("Text", Me.bsrcApplicants, "Title")
Me.txtFirstname.DataBindings.Add("Text", Me.bsrcApplicants, "Firstname")
Me.txtSurname.DataBindings.Add("Text", Me.bsrcApplicants, "Surname")
Me.txtAddress1.DataBindings.Add("Text", Me.bsrcApplicants, "Address1")
Me.txtAddress2.DataBindings.Add("Text", Me.bsrcApplicants, "Address2")
Me.txtAddress3.DataBindings.Add("Text", Me.bsrcApplicants, "Address3")
Me.txtAddress4.DataBindings.Add("Text", Me.bsrcApplicants, "Address4")
Me.txtPostCode.DataBindings.Add("Text", Me.bsrcApplicants, "Postcode")
Me.txtDateOfEntry.DataBindings.Add("Text", Me.bsrcApplicants, "DateOfEntry")
Me.txtTelephoneHome.DataBindings.Add("Text", Me.bsrcApplicants, "TelephoneHome")
Me.txtTelephoneDaytime.DataBindings.Add("Text", Me.bsrcApplicants, "TelephoneWork")
Me.txtMobile.DataBindings.Add("Text", Me.bsrcApplicants, "TelephoneMobile")
Me.txtEmail.DataBindings.Add("Text", Me.bsrcApplicants, "Email")
Me.bnavApplicants.BindingSource = Me.bsrcApplicants
'TODO
'Set parent child relation ship form for datagrid, doesnt error but the datagrid doesnt display anything
Me.bsrcApplicantComments.DataSource = Me.bsrcApplicants
Me.bsrcApplicantComments.DataMember = "FK_tbl_ApplicantComments_tbl_Applicants"
Me.grdComments.DataSource = Me.bsrcApplicantComments
Re: [RESOLVED] [2005] Databinding Help Parent Child
Solved, The code works but doesnt overwrite any properties set in the designer!
Ensure all properties to datasources in designer are set to none.