473,386 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Serial Port

I found this code which may be VB6 but I don't know

' Shut down the Comm port event processing and timer
Timer1.Enabled = False
Comm1.RThreshold = 0

What is the equivalent in VB.Net? I have the serial port working fine
and cannot find the above timer or Rthreshold.

K.
Jul 1 '08 #1
4 5367
On Jul 1, 2:59 pm, kronec...@yahoo.co.uk wrote:
I found this code which may be VB6 but I don't know

' Shut down the Comm port event processing and timer
Timer1.Enabled = False
Comm1.RThreshold = 0

What is the equivalent in VB.Net? I have the serial port working fine
and cannot find the above timer or Rthreshold.

K.
Actually I got Rthreshold ok
If SerialPort1.IsOpen Then
SerialPort1.Close()
End If
Try
With SerialPort1
.PortName = cboCommPorts.Text
.BaudRate = 4800
.Parity = IO.Ports.Parity.None
.DataBits = 8
.StopBits = IO.Ports.StopBits.One
.Handshake = IO.Ports.Handshake.XOnXOff
.ReceivedBytesThreshold = 0
End With
SerialPort1.Open()

lblMessage.Text = SerialPort1.PortName & " connected"
cmdDisconnect.Enabled = True
cmdConnect.Enabled = False
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

Still confused baout the timer though....

K.
Jul 1 '08 #2
Well so are we.

What has a Timer got to do with a SerialPort?
<kr*******@yahoo.co.ukwrote in message
news:ee**********************************@i36g2000 prf.googlegroups.com...
On Jul 1, 2:59 pm, kronec...@yahoo.co.uk wrote:
>I found this code which may be VB6 but I don't know

' Shut down the Comm port event processing and timer
Timer1.Enabled = False
Comm1.RThreshold = 0

What is the equivalent in VB.Net? I have the serial port working fine
and cannot find the above timer or Rthreshold.

K.

Actually I got Rthreshold ok
If SerialPort1.IsOpen Then
SerialPort1.Close()
End If
Try
With SerialPort1
.PortName = cboCommPorts.Text
.BaudRate = 4800
.Parity = IO.Ports.Parity.None
.DataBits = 8
.StopBits = IO.Ports.StopBits.One
.Handshake = IO.Ports.Handshake.XOnXOff
.ReceivedBytesThreshold = 0
End With
SerialPort1.Open()

lblMessage.Text = SerialPort1.PortName & " connected"
cmdDisconnect.Enabled = True
cmdConnect.Enabled = False
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

Still confused baout the timer though....

K.
Jul 1 '08 #3
On Jul 1, 6:16 pm, "Stephany Young" <noone@localhostwrote:
Well so are we.

What has a Timer got to do with a SerialPort?

<kronec...@yahoo.co.ukwrote in message

news:ee**********************************@i36g2000 prf.googlegroups.com...
On Jul 1, 2:59 pm, kronec...@yahoo.co.uk wrote:
I found this code which may be VB6 but I don't know
' Shut down the Comm port event processing and timer
Timer1.Enabled = False
Comm1.RThreshold = 0
What is the equivalent in VB.Net? I have the serial port working fine
and cannot find the above timer or Rthreshold.
K.
Actually I got Rthreshold ok
If SerialPort1.IsOpen Then
SerialPort1.Close()
End If
Try
With SerialPort1
.PortName = cboCommPorts.Text
.BaudRate = 4800
.Parity = IO.Ports.Parity.None
.DataBits = 8
.StopBits = IO.Ports.StopBits.One
.Handshake = IO.Ports.Handshake.XOnXOff
.ReceivedBytesThreshold = 0
End With
SerialPort1.Open()
lblMessage.Text = SerialPort1.PortName & " connected"
cmdDisconnect.Enabled = True
cmdConnect.Enabled = False
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Still confused baout the timer though....
K.
Here's the code here

http://www.24central.com/PPC-Source-3.html

K.
Jul 1 '08 #4
The VB6 code shown is used to poll MSComm, using a Timer control. You can
do the same in .NET. There is no equivalent for RThreshold. Most people
use the DataReceived event, but there can be reasons to use a Timer control
instead.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
Jul 1 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: ^CeFoS^ | last post by:
Hello to everybody, I've done an application that draws in a frame the trajectory of a robot. The robot position is readed through the serial port, and several commands are wrote through the...
2
by: willie | last post by:
Hi, I'm writing a program which requires the use of three serial ports and one parallel port. My application has a scanning devices on each port, which I can access fine with pyserial. ...
3
by: collinm | last post by:
hi i send a command to a led display, the led display is suppose to return me some character i write a string on a serial port void ledDisplayExist() { char msg={'\0', '\0', '\0', '\0',...
13
by: Al the programmer | last post by:
I need to access the serial ports on my webserver from an asp.net page. I have no problem accessing the serial ports from a windows form application, but the code doesn't work in asp.net. I have...
4
by: joe bloggs | last post by:
I am writing a mobile application to interface with a legacy system and I am planning to use web services to communicate with this system. The legacy system receives data through a serial port. ...
4
by: Frank | last post by:
Hello, how to get information about all serial ports in the PC? I use the following code, but i got only the data of the FIRST serial port. All other serial port information are not available...
7
by: davetelling | last post by:
I'm a newbie that is still struggling with OOP concepts & how to make things work they way I want. Using Visual C# Express, I have a form in which I added a user control to display a graph, based...
13
by: Rob | last post by:
Hi all, I am fairly new to python, but not programming and embedded. I am having an issue which I believe is related to the hardware, triggered by the software read I am doing in pySerial. I...
3
by: naveen.sabapathy | last post by:
Hi, I am trying to use virtual serial ports to develop/test my serial communication program. Running in to trouble... I am using com0com to create the virtual ports. The virtual ports seem to...
6
by: terry | last post by:
Hi, I am trying to send a character to '/dev/ttyS0' and expect the same character and upon receipt I want to send another character. I tired with Pyserial but in vain. Test Set up: 1. Send...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.