//private void classTextBox_Validating(object sender, CancelEventArgs e) //{ // e.Cancel = !MyFunction.UintValidate(((TextBox)sender).Text); // if (m_ShowValidatingWarning && e.Cancel) // MessageBox.Show("代号必需是正整數!"); //} private void priceTextBox_Validating(object sender, CancelEventArgs e) { e.Cancel = !MyFunction.DecimalValidate(((TextBox)sender).Text); if (m_ShowValidatingWarning && e.Cancel) { MessageBox.Show("價格必需是Decimal!"); } }
private void voucherDetailDataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { DataGridView view = (DataGridView)sender; string cellName = view.Columns[e.ColumnIndex].Name; if (cellName == "dgCostColumn" || cellName == "dgVolumeColumn") { if (!MyFunction.DecimalValidate((string)e.FormattedValue)) { e.Cancel = true; return; } } }
private void unitVolumeTextBox_Validating(object sender, CancelEventArgs e) { e.Cancel = !MyFunction.DecimalValidate(((TextBox)sender).Text); }