gridview单元格长度设置

使用 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); } }
}

  

  

原文地址:https://www.cnblogs.com/lhlong/p/4952458.html