C#评分小系统练习
2018-06-18 04:06:35来源:未知 阅读 ()
一个经理类
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WindowsFormsApplication1 { class PM { private int num; public int Num { get { return num; } set { num = value; } } private string name; public string Name { get { return name; } set { name = value; } } private int age; public int Age { get { return age; } set { age = value; } } private string sex; public string Sex { get { return sex; } set { sex = value; } } private string zl; public string Zl { get { return zl; } set { zl = value; } } public void ShowJudge(SE se, string assess, string score) { se.Assess = assess; se.Score = score; } } }
//建立一个员工类
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WindowsFormsApplication1 { class SE { private string num; public string Num { get { return num; } set { num = value; } } private string name="0"; public string Name { get { return name; } set { name = value; } } private string age; public string Age { get { return age; } set { age = value; } } private string sex=""; public string Sex { get { return sex; } set { sex = value; } } private int popular; public int Popular { get { return popular; } set { popular = value; } } private string assess=""; public string Assess { get { return assess; } set { assess = value; } } private string score; public string Score { get { return score; } set { score = value; } } } }
//显示窗口及评分窗口
//form1代码
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class One : Form { public One() { InitializeComponent(); } public string name2; public string ass; public string score; two frn = new two(); SE[] se = new SE[3]; private void Form1_Load(object sender, EventArgs e) { SE see = new SE(); see.Num = "111"; see.Name = "张三"; see.Age = "26"; SE sew = new SE(); sew.Num ="112"; sew.Name="周新宇"; sew.Age="22"; SE seq = new SE(); seq.Num="113"; seq.Name = "李四"; seq.Age = "30"; see.Assess = "未评价"; sew.Assess = "未评价"; seq.Assess = "未评价"; see.Score = ""; sew.Score = ""; seq.Score = ""; se[0] = see; se[1] = sew; se[2] = seq; MessageBox.Show(name2); for (int i = 0; i < se.Length; i++) { ListViewItem ls = new ListViewItem(se[i].Num); ls.SubItems.Add(se[i].Name); ls.SubItems.Add(se[i].Age); ls.SubItems.Add(se[i].Assess); ls.SubItems.Add(se[i].Score); this.listView1.Items.Add(ls); } for (int i = 0; i < se.Length; i++) { if (listView1.Items[i].SubItems[1].Text.ToString().Equals(name2) ){ MessageBox.Show(ass); listView1.Items[i].SubItems[3].Text = ass; listView1.Items[i].SubItems[4].Text = score; } } } private void listView1_DoubleClick(object sender, EventArgs e) { frn.name = listView1.SelectedItems[0].SubItems[1].Text; frn.ass = listView1.SelectedItems[0].SubItems[3].Text; frn.score = listView1.SelectedItems[0].SubItems[4].Text; frn.Show(); this.Hide(); } } }
//Form2代码
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class two : Form { public string name; public string ass; public string score; public two() { InitializeComponent(); } private void Form2_Load(object sender, EventArgs e) { One fr = new One(); textBox1.Text = name; textBox2.Text = ass; textBox3.Text = score; } private void button1_Click(object sender, EventArgs e) { name = textBox1.Text; ass = textBox2.Text; score = textBox2.Text; One fr = new One(); fr.name2 = textBox1.Text; fr.ass = textBox2.Text; fr.score = textBox3.Text; fr.Show(); this.Hide(); } } }
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:二分查找算法
- 学生信息管理系统.cpp(大二上) 2020-04-23
- 洛谷P1907口算练习题 2020-03-24
- 蓝桥杯练习(入门一) 2020-03-23
- C++常见编程--获取当前系统时间 2020-02-25
- Java固定资产管理系统 源码 jsp ssh 2020-01-09
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash