如何在datagrid中写入串行数据 [英] how to write serial data in datagrid

查看:119
本文介绍了如何在datagrid中写入串行数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为我的应用程序创建了一个数据网格.当我单击查看按钮时.它应该显示从温度传感器(串行端口)读取的斩波数据,并在一列(温度列)中显示.在另一列(时间)上,它应显示系统中的当前时间.我们该怎么做?任何想法?

I have created a datagrid for my application . When i click a view button . It should display chopped data which is read from temp sensor(serial port) ANd display in one coloumn(temperature coloumn) . On another coloumn (time) It should display the current time in system. How can we do it?? any ideas??

推荐答案

创建您的DataGridView,并在设计"视图中为它提供两列. 在您的按钮Click事件处理程序方法中,从传感器读取数据(我假设您知道该怎么做),然后:

Create your DataGridView, and give it two columns in the Design view.
In your button Click event handler method, read the data from the sensor (I assume you know how to do that), and then:

double temperature = 42.6;
myDataGridView.Rows.Add( temperature, DateTime.Now );


这篇关于如何在datagrid中写入串行数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆