using DevExpress.XtraEditors.Controls; private void dateEdit1_Validating(object sender, System.ComponentModel.CancelEventArgs e) { DateTime currentValue = (sender as DateEdit).DateTime; if(currentValue.Month != DateTime.Today.Month || currentValue.Year != DateTime.Today.Year) e.Cancel = true; } private void dateEdit1_InvalidValue(object sender, InvalidValueExceptionEventArgs e) { e.ExceptionMode = DevExpress.XtraEditors.Controls.ExceptionMode.NoAction; MessageBox.Show("Enter a date within the current month.", "Error"); }
数据输入错误提示
最新推荐文章于 2024-01-08 16:06:51 发布