public void get_peridoc_cnc()//读取维修的cn项目,30i没有 { short a = 1; short b = 9; short ret = Fanuc.cnc_rdpm_cncitem(Fanuc.h, a, ref b, tem); string str2 = "name"; System.Type type = tem.GetType(); if (ret == 0) { for (int i = 1; i < b; i++) { str2 = "name" + i; listBox1.Items.Add(i + " 项目:" + type.GetField(str2).GetValue(tem).ToString()); } } else { MessageBox.Show(ret + " "); } }