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 InvoicingTool { public partial class InvoicingCommodityCount : Form { public string strValues { get; set; } public InvoicingCommodityCount() { InitializeComponent(); } public InvoicingCommodityCount(string GoodsName) { InitializeComponent(); lblGoodsName.Text = GoodsName; } private void btnEnter_Click(object sender, EventArgs e) { if (txtPayment.Text=="") { MessageBox.Show("请输入商品数量!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtPayment.Focus(); txtPayment.SelectAll(); return; } try { decimal.Parse(txtPayment.Text.Trim()); } catch { MessageBox.Show("请输入正确的商品数量!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtPayment.Focus(); txtPayment.SelectAll(); return; } strValues = txtPayment.Text.Trim(); this.DialogResult = DialogResult.OK; this.Close(); } private void txtPayment_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode==Keys.Enter) { btnEnter_Click(null, null); } } } }