经理评价系统总结

首先把两个窗口搭建完成,然后创建一个员工类,里面放上所需要的员工信息

代码如下

  private string id;//编号

 

        public string Id

        {

            get { return id; }

            set { id = value; }

        }

        private string name;//姓名

 

        public string Name

        {

            get { return name; }

            set { name = value; }

        }

        private string age;//年龄

 

        public string Age

        {

            get { return age; }

            set { age = value; }

        }

        private string ping;//评价

 

        public string Ping

        {

            get { return ping; }

            set { ping = value; }

        }

        private string defen;//得分

 

        public string Defen

        {

            get { return defen; }

            set { defen = value; }

        }

接着在主页面创建一个员工类的对象数组,然后去主页面的load事件李初始化数组,并将数组里的数据赋值到listview里面,其他数据类型需转换成string 类型

以下是代码

  public static SE[] messsge = new SE[5];

        private void FrmShow_Load(object sender, EventArgs e)

        {

            SE se1 = new SE();

            se1.Id = "111";

            se1.Name = "王小毛";

            se1.Age = "26";

            se1.Ping = "未评价";

            se1.Defen = "0";

            messsge[0] = se1;

 

            SE se2 = new SE();

            se2.Id = "222";

            se2.Name = "周新宇";

            se2.Age = "22";

            se2.Ping = "未评价";

            se2.Defen = "0";

            messsge[1] = se2;

 

            SE se3 = new SE();

            se3.Id = "333";

            se3.Name = "张华";

            se3.Age = "25";

            se3.Ping = "未评价";

            se3.Defen = "0";

            messsge[2] = se3;

 

 

 

            for (int i = 0; i < messsge.Length; i++)

            {

                if (messsge[i]!=null)//判断不为空,如果不判断执行顺序不同,会报空值异常

                {

                    ListViewItem item = new ListViewItem(messsge[i].Id);//将数据赋到listview里

                    item.SubItems.Add(messsge[i].Name);

                    item.SubItems.Add(messsge[i].Age);

                    item.SubItems.Add(messsge[i].Ping);

                    item.SubItems.Add(messsge[i].Defen);

                    listView1.Items.Add(item);

                }

               

            

            }

        }

 

 

 

点击后进入下面的页面

 

    private void listView1_Click(object sender, EventArgs e)

        {

            FrmJudge fj = new FrmJudge();

            fj.zhazha=listView1.SelectedItems[0];//将选中的本行传到评价页面

            fj.Show();

        }

 

 

 

 

 

 

 

将值赋到控件中

     public ListViewItem zhazha;

       

        private void FrmJudge_Load(object sender, EventArgs e)

        {

            textBox1.Text = zhazha.SubItems[1].Text;

            richTextBox1.Text = zhazha.SubItems[3].Text;

            textBox2.Text = zhazha.SubItems[4].Text;

        }

 

 

 

 

关闭窗口后,listv值直接改变

  private void button1_Click(object sender, EventArgs e)

        {

            zhazha.SubItems[3].Text=richTextBox1.Text;

            zhazha.SubItems[4].Text = textBox2.Text;

            this.Close();

        }

 

 

posted @ 2018-04-03 19:17  之。  阅读(140)  评论(0编辑  收藏  举报