• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

为什么没有值?

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 Student
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        class Student
        {
            private string stuNumber;
            private string password;
            private string age;
            private string gender;


            public string StuNumber
            {
                get { return stuNumber; }
                set { stuNumber = value; }
            }
            public string Password
            {
                get { return password; }
                set { password = value; }
            }
            public string Age
            {


                get { return age; }
                set { age = value; }


            }
            public string Gender
            {
                get { return gender; }
                set { gender = value; }
            }


            public Student() { }
            public Student(string stuNumber, string password)
            {
                this.StuNumber = StuNumber;
                this.Password = password;
            }
            public Student(string StuNumber, string password, int age, string gender)
            {
                //初始化当前对象的四个属性
            }
            
            public string Show()
            {
                string message = string.Format("信息注册成功!学号{0},密码{1},年龄{2},性别{3}。",
                    this.StuNumber, this.Password, this.Age.ToString(), this.Gender);
                return message;
            }
        }
      
       private void Form1_Load(object sender, EventArgs e)
            {
                cmbGender.Items.Clear();
                cmbGender.Items.Add("男");
                cmbGender.Items.Add("女");
                cmbGender.SelectedIndex = 0;
            }           
        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }


        private void button1_Click(object sender, EventArgs e)
        {
             if (int.Parse(this.txtAge.Text) > 100 || int.Parse(this.txtAge.Text) < 0)
            {
                this.txtAge.Text = "18";
            }
            if (String.IsNullOrEmpty(this.txtStuNumber.Text) || String.IsNullOrEmpty(this.txtPassword.Text))
            {
                MessageBox.Show("用户名和密码不能为空!");
            }
            else
            {   


                if (this.txtPassword.Text != this.txtRePassword.Text)
                {
                    MessageBox.Show("密码和确认密码不一致");
                }
                else
                {
                    //Student Student = new Student();


                    Student Student = new Student(this.txtStuNumber.Text, this.txtPassword.Text,
                        
                        
                        int.Parse(this.txtAge.Text), this.cmbGender.Text);
                    MessageBox.Show(Student.Show());
                }
            }
        }


               
    }
}

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

全部参与1

贴上来 这么长的代码~`~~~

使用道具 举报

发新帖

发布任务需求已有1031167位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!