using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Grid;
private void gridView1_KeyPress(object sender, KeyPressEventArgs e) {
GridView view = sender as GridView;
string s = "0123456789";
if (view.FocusedColumn.FieldName == "CustomerID" && s.IndexOf(e.KeyChar) >= 0)
e.Handled = true;
}
private void gridControl1_EditorKeyPress(object sender, KeyPressEventArgs e) {
GridControl grid = sender as GridControl;
gridView1_KeyPress(grid.FocusedView, e);
}
转载于:https://www.cnblogs.com/cainiaoji/archive/2011/03/28/1997961.html