C#的Dev中GridControl_gridview新增添加数据
C#的Dev中GridControl_gridview新增添加数据
DataTable dt = gridControl1.DataSource as DataTable; string equ_id = comboBoxEdit_add_equ_link_id.Text; string stocker_dsr = comboBoxEdit_add_stocker_type.Text; string stocker_id = comboBoxEdit_add_stocker_id.Text; string motion_type = comboBoxEdit_add_motion_type.Text; string stocker_seq = textEdit_add_sort_number.Text; if(equ_id.Length>0&& stocker_dsr.Length > 0 && stocker_id.Length > 0 && motion_type.Length > 0 && stocker_seq.Length > 0 ) { } else { MessageBox.Show("请选择或者输入信息",CFile_Operation.molding_title,MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (dt != null) { DataRow dr = dt.NewRow(); dr["序号"] = dt.Rows.Count+1; dr["设备号"] = equ_id; dr["线边仓类型"] = stocker_dsr; dr["线边仓号"] = stocker_id; dr["动作类型"] = motion_type; dr["线边仓排序"] = stocker_seq; dr["创建时间"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); dr["创建人员"] = FrameGlobal.LoginUser.Account; dt.Rows.Add(dr); dt.AcceptChanges(); gridControl1.DataSource = dt; // gvQnA.DataBind(); }
C#的Dev中GridControl_gridview选中一行删除与读取数据
欢迎讨论,相互学习。
cdtxw@foxmail.com