How can I restrict a user to entering only numeric values in a specific cell in a DataGridView column?

前端 未结 3 1915
没有蜡笔的小新
没有蜡笔的小新 2021-01-22 21:30

I have a DataGridView control in which I want to restrict the user to entering only numeric values for a cell under a particular column. How can I accomplish this t

3条回答
  •  庸人自扰
    2021-01-22 21:54

    Use cellValidating event:

    Grid.CellValidating += new DataGridViewCellValidatingEventHandler(Grid_CellValidating);
    
    Grid_CellValidating(object sender, args)
    {
    XXXX
    }
    

提交回复
热议问题