DataGridViewComboBox: populate with different data for each row in detail grid

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nina4ever
    New Member
    • Oct 2014
    • 3

    #1

    DataGridViewComboBox: populate with different data for each row in detail grid

    Hi. I have a pair of Master-Detail DataGridViews in my WinForms App.
    One of the columns in my DETAIL grid is a ComboBox (part_name).

    ComboBox values are not the same for all rows. They differ based on the value of another column (equipment_name ) in the same row of the DETAIL grid.
    example:

    row1: equipment_name: PC part_name: RAM , Hard disc , CPU
    row2: equipment_name: printer part_name: paper tray , Inkwell

    How can i populate each ComboBox with correct values in each DETAIL row when detail rows are either filled from database or added by user? maybe using a database query? how to pass(equipment_ name) as a parameter? and where to do that? in what event handler?


    P.S. :
    1- master and detail grids are used for displaying, adding , editing and deleting rows.
    2- in this page you can find my code of creating grids. it doesn't include code for ComboBox column yet. the correct code is marked as an ANSWER.

Working...