//DataGridView的CellValidating验证事件
private void dataGV1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
decimal tmp=0.0m;
if(e.ColumnIndex==4&&e.FormattedValue!=null)
{
if(!decimal.TryParse(e.FormattedValue.ToString(),out tmp))
{
ControlOpt.ShowMessage("请输入有效数字!");
e.Cancel=true;
}
}
}