
Putting Recieved Data in a Label.Caption with MSCOMM32.OCX
Hi,
Well, you probably should not use a Label. A TextBox is a better idea. The
VBTerm example that comes with VB shows how to do this, as do a number of
examples in my book (see below for information). I have several variations
that you might choose from depending on how sophisticated a program you are
writing.
Simplest might be:
MSComm1.RThreshold = 1 'Enable OnComm receive events
MSComm1.PortOpen = True
Private Sub MSComm1_OnComm ()
Dim Buffer As String
Buffer = MSComm1.Input
If Len(Text1.Text) > 16000 Then Text1.Text = ""
Text1.SelText = Buffer
End Sub
--
Richard Grier
Hard & Software
12962 West Louisiana Avenue
Lakewood, CO 80228
303-986-2179 (voice)
303-986-3143 (fax)
Author of Visual Basic Programmer's Guide to Serial Communications, 2nd
Edition (355 pages).
For information look on my homepage at
http://ourworld.compuserve.com/homepages/richard_grier.
Use the Books link to order. For faster service contact the publisher at
http://www.mabry.com.