Click here to Skip to main content
15,887,272 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
// in the gdvReturnOrder_CellMouseUp(
C#
if (e.ColumnIndex == 0 && e.RowIndex != -1)
            //{
                DataGridViewComboBoxCell comboCell =
                   gdvReturnOrder.Rows[e.RowIndex].Cells["Column9"] as DataGridViewComboBoxCell;

                if (comboCell != null)
                {
                    comboCell.Value = comboCell.Selected;
                }

And loaded the the column through..this way:(On Button Click)
//gdvReturnOrder_Load();
<pre><pre lang="text">for (int index = 0; index < this.gdvReturnOrder.Rows.Count; index++)
                {
                        DataGridViewComboBoxCell dc = new DataGridViewComboBoxCell();
                        dc.Items.Add("Good");
                        dc.Items.Add("Loss");
                        dc.Items.Add("Damaged");
                        this.gdvReturnOrder.Rows[index].Cells["Column9"] = dc;
                        this.gdvReturnOrder.Rows[index].Cells["Column9"].Value = dc.Items[0];
                 }







It is showing values(Top most value:Good) bt I am not able to select it Is some Setting of Combobox coloumn has to be set to make it work?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900