.NET串行端口故障。将C#代码转换为VB [英] .NET Serial Port Woes. Converting C# Code to VB

查看:73
本文介绍了.NET串行端口故障。将C#代码转换为VB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天记录数据时,我遇到了SerialPort功能间歇性崩溃的麻烦。这是一个很难调试的问题,我想尝试一下Zach Saw的修补程序,他在此修补程序中谈到了此处提供了以下代码C#

I'm having trouble with the SerialPort function intermittently crashing while data logging for several days. It's been a hard problem to debug and I would like to try Zach Saw's fix which he talks about here and provides code for in C#

我的问题是,要这样做,我是否需要在代码中重写串行端口的全部用法?

My question is, to do this, do I need to rewrite the entire use of the Serial Port in my code?

如果我使用System.IO.Ports.SerialPort模块,是否可以通过SetCommState的DLLImport来将fAbortOnError设置为false,或者是否需要完全放弃SerialPort模块并使用kernel32.dll编写所有内容?

If I use the System.IO.Ports.SerialPort module, is there a way to just do a DLLImport of SetCommState to set fAbortOnError to false, or do I need to abandon the SerialPort module entirely and write everything using the kernel32.dll?

推荐答案

我很确定在这种情况下您可以导入他的项目纳入您的解决方案,它应该可以正常运行。由于VB和C#都是CLR语言,因此它们都可以编译为相同的中间语言。

I'm pretty sure in this case you could import his project into your solution, and it should run just fine. Since VB and C# are both CLR languages, they both compile down to the same intermediate language.

这篇关于.NET串行端口故障。将C#代码转换为VB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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