Results 1 to 3 of 3

Thread: Master Detail form DataGridView combobox lookup Problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Posts
    14

    Master Detail form DataGridView combobox lookup Problem

    hi
    i have a master detail form with databound datagridviews.
    my detail datagridview is bound to FKFieldSubFieldLookupTableBindingSource
    and it shows the linked sub-fields when the main field changes.
    This datagrid has only one column which is the sub-field names column. this column type is ComboBox.
    here are this combobox details

    DataSource = subFieldLookupBindingSource
    DisplayMember = sub_field_name
    value Member = sub_field_id

    No Problem until here.

    When i click on the Cell combobox I get the list of all the sub-fields. I don't want this. because once a sub-field has been associated with a Master field, it should not be available for other Master fields.

    What i did was, In the SubFieldLookup Dataset, i added a query to get all those sub-fields which haven't been associated yet.

    but this clears up the detail datagrid and shows blank comboboxes where it is supposed to have the sub-fields.

    How do I solve this issue.

    I simplly want the master-detail mechanism to work and when i want to add a new sub-field, and click the combobox in sub-fields datagrid, i want to have only those sub-fields which are marked False in database in the column 'alreadyAssociated'

    Please Help

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Master Detail form DataGridView combobox lookup Problem

    You can't bind the column. You need to populate each ComboBox control individually on demand. You should look at the EditingControlShowing event, which is raised each time the user starts editing a cell.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Posts
    14

    Re: Master Detail form DataGridView combobox lookup Problem

    That did the job bang on...
    Thank a trillion dude, main reason why i love this forum :-)

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