private void button2_Click(object sender, EventArgs e) { if (IsStart) { SetClass.m_port.RTUs[0].SetRegister(33, 0); IsStart = false;
//这里报错:“未将对象引用设置到对象实例” button2.Text = "启动"; button2.BackColor = Color.Green; } else { SetClass.m_port.RTUs[0].SetRegister(33, 1); IsStart = true; button2.BackColor = Color.Red; button2.Text = "停止"; } } }}
//这里报错:“未将对象引用设置到对象实例” button2.Text = "启动"; button2.BackColor = Color.Green; } else { SetClass.m_port.RTUs[0].SetRegister(33, 1); IsStart = true; button2.BackColor = Color.Red; button2.Text = "停止"; } } }}
解决方案 »
- c# treeview刷新问题
- 把如何把BTYE数据弄成图片呈现到页面上
- 求救高人:socket通信 +多线程
- 哈哈,SHOW 代码! 不重复随机数产生的算法!!!
- 谁能给我一个WPF的好教程,和silverlight的
- DataTable.Select()方法的一些问题
- 怎么把一些数据保存下来,保存在类里
- VS2005中乍样把语言改成C#呢(原来是VB)
- 写了一个windows服务到局域网上读写文件,,请问读写的权限与什么有关?
- 请问:当我引入requiredfieldvalidator控件时,运行时告诉我aspnet_client\system_web\1_0_3705_0\WebUIValidation.js找不到。
- 如何终止XmlDocument类中的Load方法?
- 哪位大神正则好一点,求转一个正则
有一段简单的代码 SetClass.m_port.RTUs[0].SetRegister(33, 0);
IsStart = false;
button2.Text = "启动";
button2.BackColor = Color.Green; SetClass.m_port.RTUs[0].SetRegister(33, 0);也是报错,问下有可能是什么原因