
C#学生信息管理系统(共10页).doc
10页《C#程序设计》课程设计报告学生信息管理系统院系: 信息技术学院 专业: 计算机科学与技术 设计题目:学生信息管理系统1. 题目描述 学生信息包括:学号,姓名,年龄,性别,出生年月,地址,入学成绩等试设计 一 学生信息管理系统,使之能提供以下功能:1、录入学生信息(学生信息用文件或数据库保存)2、浏览学生信息3、查询学生信息(按姓名查询、按成绩查询等)4、修改学生信息5、追加一个学生信息6、删除一个学生信息7、统计学生信息2. 应用程序功能说明 2.1、录入学生信息:单击“录入学生基本信息”按钮,可将学生的学号、姓名、年龄、性别、联系、家庭地址、入学成绩等录入,再单击“确定”,就可成功录入信息2.2、浏览学生信息:单击“浏览学生基本信息”,可以直接看到全部学生的信息2.3、查询学生信息:单击“查询学生基本信息”,可以按两种方式查询想要查的学生信息,一种是按姓名和成绩,一种是按姓名和学号查询2.4、修改学生信息:单击“修改学生基本信息”,在查询的基础上,进行个别要修改的项2.5、追加一个学生信息:选择“添加学生基本信息”,可以继续添加学生信息。
2.6、删除一个学生信息:单击“删除学生基本信息”,输入学号和姓名确定某一学生,再单击“删除”按钮 2.7、统计学生信息:单击“统计学生基本信息”,主要是统计共有多少学生的信息3. 源程序 3.1 实现录入 private void button1_Click(object sender, EventArgs e) { Student stu = new Student(); stu.StrNo += textBox1.Text; stu.StrName += textBox2.Text; stu.StrSex += textBox3.Text; stu.StrAge += textBox4.Text; stu.StrProgress += textBox5.Text; stu.StrAddress += textBox6.Text; stu.StrPhone += textBox7.Text; if (textBox1.Text == "") { MessageBox.Show("请输入学号!"); return; } if (textBox2.Text == "") { MessageBox.Show("请输入姓名!"); return; } else { MessageBox.Show("恭喜你,添加成功!"); } Form4.ALStudent.Add(stu); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; textBox7.Text = ""; } 3.2 浏览信息 private void Form3_Load(object sender, EventArgs e) { listBox1.HorizontalScrollbar = true; listBox1.ScrollAlwaysVisible = true; for (int i = 0; i < Form4.ALStudent.Count; i++) { listBox1.Items.Add(Form4.ALStudent[i]); } } 3.3删除 public static ArrayList ALStudent = new ArrayList(); private void button1_Click(object sender, EventArgs e) { for (int i = 0; i < ALStudent.Count; i++) { string strNum = textBox1.Text; string strXing = textBox2.Text; if (((Student)ALStudent[i]).StrNo == strNum && ((Student)ALStudent[i]).StrName == strXing) { MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel); ALStudent.RemoveAt(i); } } } 3.4分别按姓名、学号或姓名、成绩查询 private void radioButton1_CheckedChanged(object sender, EventArgs e) { for (int i = 0; i < ALStudent.Count; i++) { string strNo = textBox3.Text; string strName = textBox4.Text; if (((Student)ALStudent[i]).StrNo == strNo && ((Student)ALStudent[i]).StrName == strName) { textBox6.Text = "学号:" + ((Student)ALStudent[i]).StrNo + " " + "姓名:" + ((Student)ALStudent[i]).StrName + " " + "年龄:" + ((Student)ALStudent[i]).StrAge + " " + "性别:" + ((Student)ALStudent[i]).StrSex + " " + "入学成绩:" + ((Student)ALStudent[i]).StrProgress + " " + "家庭住址:" + ((Student)ALStudent[i]).StrAddress + " " + "联系:" + ((Student)ALStudent[i]).StrPhone + "\n"; MessageBox.Show("查询成功!"); return; } if (((Student)ALStudent[i]).StrNo != strNo || ((Student)ALStudent[i]).StrName != strName) { MessageBox.Show("此人不存在!"); return; } } } private void radioButton2_CheckedChanged(object sender, EventArgs e) { for (int i = 0; i < ALStudent.Count; i++) { string strProgress = textBox5.Text; string strName = textBox4.Text; if (((Student)ALStudent[i]).StrProgress == strProgress && ((Student)ALStudent[i]).StrName == strName) { textBox6.Text = "学号:" + ((Student)ALStudent[i]).StrNo + " " + "姓名:" + ((Student)ALStudent[i]).StrName + " " + "年龄:" + ((Student)ALStudent[i]).StrAge + " " + "性别:" + ((Student)ALStudent[i]).StrSex + " " + "入学成绩:" + ((Student)ALStudent[i]).StrProgress + " " + "家庭住址:" + ((Student)ALStudent[i]).StrAddress + " " + "联系:" + ((Student)ALStudent[i]).StrPhone + "\n"; MessageBox.Show("查询成功!"); } if (((Student)ALStudent[i]).StrProgress != strProgress || ((Student)ALStudent[i]).StrName != strName) { MessageBox.Show("此人不存在!"); } } } 3.5修改学生信息 private void button3_Click(object 。
