UCLEDSet.cs 1.29 KB
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UserCtrlsByDXC
{
    public partial class UCLEDSet : UserControl
    {
        public UCLEDSet()
        {
            InitializeComponent();
        }

        private void tBip_Leave(object sender, EventArgs e)
        {
            TextBox tb = sender as TextBox;
            Label lb = this.Controls.Find(string.Format("lb{0}", tb.Name.Substring(2)), false)[0] as Label;
            if (!OtherHelper.ValidateUserInput(tb.Text.Trim(), 24))
            {
                MessageBox.Show(string.Format("请输入正确的{0}!", lb.Text.Replace(":", "")));
                tb.Focus();
                return;
            }
        }

        private void tBint_Leave(object sender, EventArgs e)
        {
            TextBox tb = sender as TextBox;
            Label lb = this.Controls.Find(string.Format("lb{0}", tb.Name.Substring(2)), false)[0] as Label;
            if (!OtherHelper.ValidateUserInput(tb.Text.Trim(), 2))
            {
                MessageBox.Show(string.Format("请输入正确的{0}!", lb.Text.Replace(":", "")));
                tb.Focus();
                return;
            }
        }
    }
}