zoukankan      html  css  js  c++  java
  • 回车 登录

    using System;
    using System.Linq;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
     
    namespace PDAExample
    {
        /// <summary>
        /// 登录
        /// @Author cluo
        /// @Date 2011-12-23
        /// </summary>
        public partial class FrmLogin : Form
        {
            public FrmLogin()
            {
                InitializeComponent();
            }
     
            // 输入验证
            private bool ValidateInput()
            {
                if (string.IsNullOrEmpty(txtLoginID.Text.Trim()))
                {
                    MessageBox.Show("请输入用户名");
                    txtLoginID.SelectAll();
                    txtLoginID.Focus();
                    return false;
                }
                else if (string.IsNullOrEmpty(txtLoginPwd.Text.Trim()))
                {
                    MessageBox.Show("请输入密码");
                    txtLoginPwd.SelectAll();
                    txtLoginPwd.Focus();
                    return false;
                }
                return true;
            }
     
            // 用户名校验
            private void txtLoginID_KeyPress(object sender, KeyPressEventArgs e)
            {
                if (e.KeyChar != 13) return;
                ValidateInput();
            }
     
            // 密码校验
            private void txtLoginPwd_KeyPress(object sender, KeyPressEventArgs e)
            {
                if (e.KeyChar != 13) return;
                if (ValidateInput()) btnLogin_Click(null, null);
            }
     
            // 登录
            private void btnLogin_Click(object sender, EventArgs e)
            {
                if (ValidateInput())
                {
                    MessageBox.Show("登录成功");
                }
            }
     
            // 取消
            private void btnCancel_Click(object sender, EventArgs e)
            {
                Application.Exit();
            }
        }
    }
  • 相关阅读:
    xsd的解释说明
    SDUT 2498-AOE网上的关键路径(spfa+字典序路径)
    java实现各种数据统计图(柱形图,饼图,折线图)
    软件測试计划模板
    范式图形辨析
    Android做法说明(3)---Fragment使用app袋或v4包解析
    登录同步多个副本如何实现的拷贝数发生变化分布式
    ZOJ1463:Brackets Sequence(间隙DP)
    jquery php 百度搜索框智能提示效果
    Hibernate在关于一对多,多对一双向关联映射
  • 原文地址:https://www.cnblogs.com/x666066/p/11407829.html
Copyright © 2011-2022 走看看