显示员工信息,实现项目经理给员工评分功能
1.1
1.2///创建一个长度为3的数组 SE[] se = new SE[3]; 1.2///初始化并把信息遍历出来 private void FrmShow_Load(object sender, EventArgs e) { se[0] = new SE(); se[0].id = 111; se[0].name = "王小毛"; se[0].age = 26; se[0].valuation = "未评价"; se[0].price = 0; se[1] = new SE(); se[1].id = 112; se[1].name = "周新宇"; se[1].age = 22; se[1].valuation = "未评价"; se[1].price = 0; se[2] = new SE(); se[2].id = 113; se[2].name = "张烨"; se[2].age = 30; se[2].valuation = "未评价"; se[2].price = 0; //遍历数据 for (int i = 0; i < se.Length; i++) { ListViewItem item = new ListViewItem(se[i].id.ToString()); item.SubItems.Add(se[i].name); item.SubItems.Add(se[i].age.ToString()); item.SubItems.Add(se[i].valuation); item.SubItems.Add(se[i].price.ToString()); lvList.Items.Add(item); } } 1.3///在FrmJudge窗体 ///单击选中的数据把数据传递给FramJudge窗体在Load事件里显示出来 ///声明一个ListViewItem 变量 public ListViewItem date; private void FrmJudge_Load(object sender, EventArgs e) { txt01.Text = date.SubItems[1].Text; txt02.Text = date.SubItems[3].Text; txt03.Text = date.SubItems[4].Text; }
1.4////取消按钮 private void btnCal_Click(object sender, EventArgs e) { this.Close(); } //把修改的数据传递给listView private void btnpf_Click(object sender, EventArgs e) { date.SubItems[3].Text = txt02.Text; date.SubItems[4].Text = txt03.Text; }
1.5///SE对象
public class SE
{
public int id;
public int age;
public string name;
public string gender;
public int value;
public int price;
public string valuation;
}