private void txtRate_Validating(object sender, CancelEventArgs e) { if (txtRate.Text != "") { if (VoucherBatchManage.IsNumber(txtRate.Text) == false) { MessageBox.Show("请输入符合的数字", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); txtRate.Clear(); txtRate.DataBindings.Clear(); txtRate.DataBindings.Add("Text", dataBindingSource, "TaxRate", true); txtRate.Focus(); return; } } else { txtRate.Text = "0"; } }
private void txtLowestPrice_Validating(object sender, CancelEventArgs e) { if (txtLowestPrice.Text == "" || txtLowestPrice.Text.Trim() == "0") { MessageBox.Show("影片最低票价不能为空或0!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (VoucherBatchManage.IsNumber(txtLowestPrice.Text) == false) { MessageBox.Show("影片最低票价请输入整数", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); //txtLowestPrice.Clear(); //txtLowestPrice.DataBindings.Clear(); //txtLowestPrice.DataBindings.Add("Text", dataBindingSource, "LowestPrice", true); //txtLowestPrice.Focus(); return; } } }
private void txtRatio_Validating(object sender, CancelEventArgs e) { if (txtRatio.Text != "") { if (VoucherBatchManage.IsNumber(txtRatio.Text) == false) { MessageBox.Show("片方分账比例请输入数字", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); // txtRatio.Clear(); // txtRatio.DataBindings.Clear(); // txtRatio.DataBindings.Add("Text", dataBindingSource, "Ratio", true); // txtRatio.DataBindings["Text"].Format += TextBox_Percent_Format; // txtRatio.DataBindings["Text"].Parse += TextBox_Percent_Parse; // txtRatio.Focus(); // return; } } //else //{ // txtRatio.Text = "0"; //} }
private void txtGroupPrice_Validating(object sender, CancelEventArgs e) { if (txtGroupPrice.Text != "") { txtGroupPrice.Text = txtGroupPrice.Text.Replace("元", string.Empty); if (VoucherBatchManage.IsNumber(txtGroupPrice.Text) == false) { MessageBox.Show("请输入整数", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); txtGroupPrice.DataBindings.Clear(); txtGroupPrice.DataBindings.Add("Text", dataBindingSource, "GroupPrice", true); txtGroupPrice.DataBindings["Text"].Format += TextBox_Currency_Format; txtGroupPrice.DataBindings["Text"].Parse += TextBox_Currency_Parse; txtGroupPrice.Clear(); txtGroupPrice.Focus(); return; } } else { txtGroupPrice.Text = "0"; } }