C#可视化Windows窗体应用程序(学生注册界面)

编写一个学生注册界面
要用到的控件
lable、textbox、groupbox、radioButton、checkBox、comboBox、button。
代码如下:

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 _20190701048周皇实验二
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string a = "";
            a += textBox1.Text + ",您好,欢迎进入C#世界!\n";
            a += "您的密码是:" + textBox2.Text;
            if (radioButton1.Checked)
                a += "\n您的性别是:" + radioButton1.Text;
            if (radioButton2.Checked)
                a += "\n您的性别是:" + radioButton2.Text;
            a += "\n您的学校是:" + comboBox1.Text;
            a += "\n您的专业是:" + comboBox2.Text;
            a += "\n您的爱好是:";
            if (checkBox1.Checked)
                a += checkBox1.Text + " ";
            if (checkBox2.Checked)
                a += checkBox2.Text + " ";
            if (checkBox3.Checked)
                a += checkBox3.Text + " ";
            if (checkBox4.Checked)
                a += checkBox4.Text + " ";
            a += "\n人生状态是:";
            if (radioButton3.Checked)
                a += radioButton3.Text;
            if (radioButton4.Checked)
                a += radioButton4.Text;
            if ((!radioButton1.Checked) && (!radioButton2.Checked))
                MessageBox.Show("你是人妖么?(填写性别!!!)");
            if ((!radioButton3.Checked) && (!radioButton4.Checked))
                MessageBox.Show("你是挂了吗?(怎么能没有人生状态!!!)");
            if ((!checkBox1.Checked) && (!checkBox2.Checked) && (!checkBox3.Checked) && (!checkBox4.Checked))
                MessageBox.Show("这个做人嘛!还是要有点兴趣爱好的!!!");
            if (textBox1.Text == "")
                MessageBox.Show("请填写姓名!!!");
            if (textBox2.Text == "")
                MessageBox.Show("请输入密码!!!");
            if (comboBox1.Text == "")
                MessageBox.Show("请选择你所在的学校!!!");
            if (comboBox2.Text == "")
                MessageBox.Show("请选择你的专业!!!");
            label9.Text = a;
        }
    }
}

运行结果:
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值