Results 1 to 2 of 2

Thread: [RESOLVED] [2005] Databinding Help Parent Child

  1. #1

    Thread Starter
    Frenzied Member FishGuy's Avatar
    Join Date
    Mar 2005
    Location
    Bradford UK
    Posts
    1,708

    Resolved [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:
    1. objApplicantCollection = New ApplicantCollection 'Not an actual Collection class just used for dataset level operations
    2.         objDataConnection = New DataConnection 'Used for making calls to the database
    3.         objApplicantCollection.FillApplicants() 'Call sub in class which fills public dataset via dataconnection class
    4.      
    5.  
    6.         Me.bsrcApplicants.DataSource = objDataConnection.ddsApplicantCollection 'Set datasource of bindingsource
    7.  
    8.    
    9.         Me.txtApplicantID.DataBindings.Add("Text", Me.bsrcApplicants, "PK_ApplicantID")
    10.         Me.txtTitle.DataBindings.Add("Text", Me.bsrcApplicants, "Title")
    11.         Me.txtFirstname.DataBindings.Add("Text", Me.bsrcApplicants, "Firstname")
    12.         Me.txtSurname.DataBindings.Add("Text", Me.bsrcApplicants, "Surname")
    13.         Me.txtAddress1.DataBindings.Add("Text", Me.bsrcApplicants, "Address1")
    14.         Me.txtAddress2.DataBindings.Add("Text", Me.bsrcApplicants, "Address2")
    15.         Me.txtAddress3.DataBindings.Add("Text", Me.bsrcApplicants, "Address3")
    16.         Me.txtAddress4.DataBindings.Add("Text", Me.bsrcApplicants, "Address4")
    17.         Me.txtPostCode.DataBindings.Add("Text", Me.bsrcApplicants, "Postcode")
    18.         Me.txtDateOfEntry.DataBindings.Add("Text", Me.bsrcApplicants, "DateOfEntry")
    19.         Me.txtTelephoneHome.DataBindings.Add("Text", Me.bsrcApplicants, "TelephoneHome")
    20.         Me.txtTelephoneDaytime.DataBindings.Add("Text", Me.bsrcApplicants, "TelephoneWork")
    21.         Me.txtMobile.DataBindings.Add("Text", Me.bsrcApplicants, "TelephoneMobile")
    22.         Me.txtEmail.DataBindings.Add("Text", Me.bsrcApplicants, "Email")
    23.         Me.bnavApplicants.BindingSource = Me.bsrcApplicants
    24.  
    25.      
    26.  
    27. 'TODO
    28. 'Set parent child relation ship form for datagrid, doesnt error but the datagrid doesnt display anything
    29.        
    30.         Me.bsrcApplicantComments.DataSource = Me.bsrcApplicants
    31.         Me.bsrcApplicantComments.DataMember = "FK_tbl_ApplicantComments_tbl_Applicants"
    32.         Me.grdComments.DataSource = Me.bsrcApplicantComments
    Last edited by FishGuy; Jan 18th, 2007 at 07:35 AM.

  2. #2

    Thread Starter
    Frenzied Member FishGuy's Avatar
    Join Date
    Mar 2005
    Location
    Bradford UK
    Posts
    1,708

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width