private void gdv_reguline_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
{
int col = ((DevExpress.XtraGrid.Views.Grid.GridView)sender).FocusedColumn.AbsoluteIndex;
if (col == 4 || col == 5)
{
object v = e.Value;
int tm;
if (v != null && (!Int32.TryParse(v.ToString(),out tm) || tm<0 )) //自定義驗證邏輯
{
e.Valid = false; //控制是否通過驗證的開關
e.ErrorText = "必須輸入正整數!"; //提示的驗證失敗的原因
}
}
}