.NET串行端口故障。将C#代码转换为VB [英] .NET Serial Port Woes. Converting C# Code to 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屋!