如何在Form2中使用Form1 serialPort [英] How to use form1 serialPort in form2

查看:149
本文介绍了如何在Form2中使用Form1 serialPort的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部,
我正在Vb.Net中开发vb应用程序.我在Form1中使用serialport属性.现在我想在Form2中使用相同的串行端口.如何使用.......而且我还需要以另一种形式附加Datareceive事件.怎么

AnyBody可以帮助我plzzzzzzzz

Hai All,
I am developing vb application in Vb.Net . I am using serialport property in Form1. Now i want to use that same serialport in Form2 .How can i use ....... And also i need to append the Datareceive event in another form . How

AnyBody help me plzzzzzzzz

推荐答案

您可以创建一个用于处理串行通信的类,并在其中进行工作,只需调用其方法即可.要在串行端口处理程序的许多实例之间共享串行端口句柄,请在serial port handlestatic property之间添加一个,以便在多个实例之间共享它.

希望对您有所帮助.
You can create a class for handling Serial communication and do your job in it and just call its methods. To share the serial port handle between many instances of your serial port handler make serial port handle a static property so that it is being shared between multiple instances.

Hope it helps.


在NET 2.0中的串行端口上通信 [ ^ ]

I/O端口编程(并行端口)读/写+使用VB.NET的监视系统 [ ^ ]


检查这些链接,这些链接上的源代码将帮助您.....:)
Communication on a serial port in NET 2.0[^]

I/O Ports Programming (Parallel port) Reading / Writing + Surveillance System using VB.NET[^]


Check these links the source code on these links will helps you.....:)


这篇关于如何在Form2中使用Form1 serialPort的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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