紧急 NModbus timeout 信息放到toolStripStatusLabel

EmmaFinn 2013-08-23 03:14:10
大侠们,

请问有谁知道,如何捕捉Modbus通讯里的timeout...
我现在整个程序已经设计好,使用NModbus library. 唯一缺失的就是假如我的master正在通讯,此时如果我将线路断开,我希望看到的是timeout或者链接不正确的toolStripStatusLabel 文字提醒。
请问我将如何捕捉timeout 的信息呢—— 如何将它放到toolStripStatusLabel。
多谢大家,在线等。请大家多帮忙!

...全文
104 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
批量删除图片透明区 压缩图片功能 public string mSelectPath;//当前选择路径 public Form1() { InitializeComponent(); this.toolStripStatusLabel1.Text = "准备就绪"; } private void button1_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); open.Multiselect = true; open.Filter = "图片|*.png"; if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Tools.Export(new List(open.FileNames), "D://output"); } this.toolStripStatusLabel1.Text = "图片压缩完成"; } private void button2_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.mSelectPath)) { this.toolStripStatusLabel1.Text = "路径不合法"; } else { Tools.ExportFolder(this.mSelectPath, "D://output"); this.RefershTreeView(); this.toolStripStatusLabel1.Text = "导出完成"; } } private void button3_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.mSelectPath)) { this.toolStripStatusLabel1.Text = "路径不合法"; } else { Tools.ChangeImgName(new DirectoryInfo(this.mSelectPath)); this.RefershTreeView(); this.toolStripStatusLabel1.Text = "重命名操作完成"; } } private void linkLabel1_Click(object sender, EventArgs e) { FolderBrowserDialog fb = new FolderBrowserDialog(); if(fb.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.mSelectPath = fb.SelectedPath; this.textBox1.Text = fb.SelectedPath; this.RefershTreeView(); this.toolStripStatusLabel1.Text = "选择路径:" + this.mSelectPath; } }

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧