1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
public ListViewItem lv; private void Form1_Load( object sender, EventArgs e) { string sename = lv.SubItems[1].Text; txtsename.Text = sename; } private void btnexit_Click( object sender, EventArgs e) { this .Close(); } private void btnok_Click( object sender, EventArgs e) { if (isnull() == true ) { string suggest = txtwritesuggest.Text; int suggestscore = 0; try { suggestscore = Convert.ToInt32(txtpmscore.Text); } catch (Exception) { MessageBox.Show( "请正确输入!" ); } lv.SubItems[3].Text = suggest; lv.SubItems[4].Text = suggestscore.ToString(); } this .Hide(); } public bool isnull() { if (txtwritesuggest.Text.Equals( string .Empty)) { MessageBox.Show( "请填写评价" ); this .txtwritesuggest.Focus(); return false ; } else if (txtpmscore.Text.Equals( string .Empty)) { MessageBox.Show( "请填写评分" ); this .txtpmscore.Focus(); return false ; } else { return true ; } } |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
public LOOK() { InitializeComponent(); fuzhi(); zhanshi(); } public SE[] user = new SE[3]; private void LOOK_Load( object sender, EventArgs e) { } public void fuzhi() { SE a = new SE(); a.Id = "111" ; a.Name = "王小毛" ; a.Age = "26" ; a.appraise = "未评价" ; a.Scoer = "0" ; user[0] = a; SE a1 = new SE(); a1.Id = "112" ; a1.Name = "周新宇" ; a1.Age = "22" ; a1.appraise = "未评价" ; a1.Scoer = "0" ; user[1] = a1; SE a2 = new SE(); a2.Id = "113" ; a2.Name = "张硕" ; a2.Age = "23" ; a2.appraise = "未评价" ; a2.Scoer = "0" ; user[2] = a2; } public void zhanshi() { for ( int i = 0; i < user.Length; i++) { ListViewItem lv= new ListViewItem(); lv.Text = user[i].Id; lv.SubItems.Add(user[i].Name); lv.SubItems.Add(user[i].Age.ToString()); lv.SubItems.Add(user[i].appraise); lv.SubItems.Add(user[i].Scoer.ToString()); listVi.Items.Add(lv); } } private void listVi_SelectedIndexChanged( object sender, EventArgs e) { } private void listVi_DoubleClick( object sender, EventArgs e) { ListViewItem lvlistitem = listVi.SelectedItems[0]; Form1 frm = new Form1(); frm.lv = lvlistitem; frm.Show(); } } } |
1
2
3
4
5
6
7
8
9
10
|
public class SE { public string Id { get ; set ; } public string Name { get ; set ; } public string Age { get ; set ; } public string appraise { get ; set ; } public string Scoer { get ; set ; } public string Senum { get ; set ; } } |