实验七-web应用程序---2018-11-19

登录界面的设计

1.实验要求:编写Web应用程序,使用Label,TextBox,Button控件,实现简单的登录界面。
2.运行效果图:

3.操作提示:

  • 创建Web应用程序:新建一个C#的空的Web应用程序。
  • 项目中右击添加Web窗体,输入名字。有三种浏览模式,设计,拆分,源。
  • 拖动三个Label控件,三个TextBox控件,一个Button控件,并设置相关属性。
  • 右击按钮控件,点击代码,跳到代码编辑。
protected void Button1_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "") TextBox3.Text = "请输入用户名";
            else if (TextBox2.Text == "") TextBox3.Text = "请输入密码";
            else if (TextBox1.Text != "abc") TextBox3.Text = "用户姓名错误";
            else if (TextBox2.Text != "abc") TextBox3.Text = "用户密码错误";
            else TextBox3.Text = "登陆成功";
        }

4.运行程序,调试

你可能感兴趣的:(实验七-web应用程序---2018-11-19)