In DataGridView control of windows form we can set the column type " DataGridViewComboBoxColumn " to show combo box in the cells of the column. Sometimes we need to show only a single or few cells having combo box. For this we need to add Combo box to the required cell on run time. Here is the sample code to do the same - //to get the correct cell get value of row and column indexs of the cell ColIndex = 1; RowIndex = 1; DataGridViewComboBoxCell ComboBoxCell = new DataGridViewComboBoxCell(); ComboBoxCell.Items.AddRange("XYZ", "ABC", "PQR"); ComboBoxCell.Value = "XYZ"; datagridview1[ColIndex, RowIndex] = ComboBoxCell; From the above code DataGirdCell at the location (1,1) will be converted to a "DataGridViewComboBoxCell" and combo box will be shown in the cell. It might be possible that to dropdown the combo box multiple mouse clicks are required. To activate combo box on single click fol
Learn Tips and tricks, Concepts, Ideas for software development