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; using ocean; namespace demo.UI { public partial class FormPrepar : Form { public FormPrepar() { InitializeComponent(); } private int _count = 0; //料盘数量 public int Count { get { return _count; } set { _count = value; } } private string _lot = ""; //料号 public string Lot { get { return _lot; } set { _lot = value; } } private void FormPrepar_Load(object sender, EventArgs e) { textBox2.Text = _lot; textBox1.Text = _count.ToString(); } private void button1_Click(object sender, EventArgs e) {//确定 int ret = 0; string str; if (!sys.is_number(textBox1.Text)) { MessageBox.Show("请输入一个整数."); textBox1.Focus(); textBox1.SelectAll(); return; } ret = Convert.ToInt32(textBox1.Text); if (ret < 0 || ret > 20) { MessageBox.Show("请输入一个合适的正整数[1,20]"); textBox1.Focus(); textBox1.SelectAll(); return; } str = textBox2.Text; if (str.Length > 31) { MessageBox.Show("lot输入长度超限."); textBox2.Focus(); textBox2.SelectAll(); return; } _lot = str; _count = Convert.ToInt32(textBox1.Text); this.DialogResult = DialogResult.OK; this.Close(); } private void button2_Click(object sender, EventArgs e) { this.Close(); } } }