示例#1
0
        public void get_mente_special()//读取维修的机床项目
        {
            listBox5.Items.Clear();
            short  a    = 1;                                              //说明开始读取的序列号
            short  b    = 11;                                             //表示读取的维修项目的数量
            short  ret  = Fanuc.cnc_rdpm_mcnitem(Fanuc.h, a, ref b, tem); //ref b,返回的是机器里实际读取的数量
            string str2 = "name";

            System.Type type = tem.GetType();


            if (ret == 0)
            {
                for (int i = 1; i < b; i++)
                {
                    str2 = "name" + i;
                    listBox5.Items.Add(i + "    :" + type.GetField(str2).GetValue(tem).ToString());
                }
            }
            else
            {
                MessageBox.Show(ret + " ");
            }
        }