比如说CELL只能输入数字或固定字符

解决方案 »

  1.   

    dataGridView1.Columns[0].ValueType = typeof(int);
      

  2.   

    固定字符限制的话,要实现CellValidating事件
     private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
            {
                if (e.ColumnIndex != 1)
                {
                    return;
                }
                if (e.FormattedValue.ToString() == "abc")//换成你的判断条件
                {
                    e.Cancel = true;
                }
            }