DataGridViewComboBoxColumn和DataGridView
我现在想在DataGridView中加一个combox这个控件不管是System.windwos.forms.combox还是DataGridViewComboBoxColumn
我要想达到的功能就是
当单击一下DataGridView中的某单元格时,出现一个combox供我选择,这可以达到,
当选择后,我要赋值给DataGridView中的当前行的某些列的单元格,也可以达到问题所在:
赋值不稳定,有时明明选择combox中的值后不移开,可以看到赋值,但把鼠标移开后,赋值不见了.
有时会崩了,赋值多了或是不停赋值,整个DataGridView会崩导至系统崩!错误提示说是什么数组超出范围的东东请高手分析原因和指出好的方法解决此问题.以下为赋值代码
if(this.cdgvAc.CurrentRow.Cells["WorkOrderCode"]!= null )
                        this.cdgvAc.CurrentRow.Cells["WorkOrderCode"].Value = this.txtGxCode.Text.Trim();//工序编号                        if(this.cdgvAc.CurrentRow.Cells["ActionCode"]!=null )
                        this.cdgvAc.CurrentRow.Cells["ActionCode"].Value = dtAct.Rows[0].ItemArray[1].ToString().Trim();//动作代码                        if(this.cdgvAc.CurrentRow.Cells["ActionName"]!=null) 
                        this.cdgvAc.CurrentRow.Cells["ActionName"].Value = dtAct.Rows[0].ItemArray[2].ToString().Trim();//动作名称                        if(this.cdgvAc.CurrentRow.Cells["ActionOrder"]!=null )
                        this.cdgvAc.CurrentRow.Cells["ActionOrder"].Value = dtAct.Rows[0].ItemArray[4].ToString().Trim();//动作顺序                        if (dtAct.Rows[0].ItemArray[5].ToString().Trim() == "False")
                        {
                            if(this.cdgvAc.CurrentRow.Cells["ManualTMU"]!=null)
                            this.cdgvAc.CurrentRow.Cells["ManualTMU"].Value = dtAct.Rows[0].ItemArray[3].ToString().Trim();
                        }
                        else
                        {
                            if(this.cdgvAc.CurrentRow.Cells["MachineTMU"]!=null)
                            this.cdgvAc.CurrentRow.Cells["MachineTMU"].Value = dtAct.Rows[0].ItemArray[3].ToString().Trim();
                        }