using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace DataUpdate { public partial class PaymentMain : Form { private string _strpay = ""; public string strpay { get { return _strpay; } set { _strpay = value; } } public PaymentMain() { InitializeComponent(); } private void txtPayment_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { btnEnter_Click(null, null); } } private void btnEnter_Click(object sender, EventArgs e) { if (txtPayment.Text.Trim() != "") { try { decimal.Parse(txtPayment.Text.Trim()); } catch { MessageBox.Show("请输入正确的缴款金额", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtPayment.Clear(); txtPayment.Focus(); txtPayment.SelectAll(); return; } _strpay = txtPayment.Text.Trim(); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("请输入缴款金额", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtPayment.Clear(); txtPayment.Focus(); txtPayment.SelectAll(); return; } } private void PaymentMain_FormClosing(object sender, FormClosingEventArgs e) { if (this.DialogResult != DialogResult.OK) { e.Cancel = true; } } } }