Serial Port

K

kronecker

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.
 
K

kronecker

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.
 
D

Dick Grier

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top