使用 gridView1_CellValueChanged 事件
private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { //m_tblDataList = ((DataView)this.gridView1.DataSource).Table.Copy(); if (e.Column.Name.ToString().Equals(t_stockindetail.remark)) { string strRemark = e.Value.ToString(); if (strRemark.Length>256) { //m_tblDataList为gridview数据源 m_tblDataList.Rows[e.RowHandle]["remark"] = strRemark.Substring(0, 256); XtraMsgBox.Show("备注不能查过256位", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
时间: 2025-01-06 14:17:48