我手动在datagridview上添加了几个列其中有个combobox列,但是我不知道该怎么给这列的单元格(combobox)动态赋值。知道的大虾教小弟一下,谢啦。

解决方案 »

  1.   

    今天有人问过了
    http://topic.csdn.net/u/20100509/12/04a5426a-7de4-4577-9f6d-cd59885641e8.html
      

  2.   


    我的不是绑定数据库的数据
    我动态向里面加值。我在属性里面改不行。定义datagridviewcomboboxcell也不行
      

  3.   

     ServiceController[] services = ServiceController.GetServices();
                    int i = 0;
                    foreach (ServiceController service in services)
                    {
                        dataGridView_test.Rows.Add(1);
                        dataGridView_test.Rows[i].Cells[0].Value = service.DisplayName;
                        DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)dataGridView_test.Rows[i].Cells[1];
                        c.Items.Add("stop");
                        c.Items.Add("manual");
                        c.Items.Add("auto");
                        i++;
                    }