Whats wrong with this code.... receiving data from com

I am trying to get data from the com port (picaxe to  be specific) but  im afraid this code is vb6 and the mscomm (axmscomm) doesn't recognise 'comEvReceive' and the 'SelLength', 'SelText', 'SelStart' are 'not members of system.windows.forms.label' I just need a few translations... OR ive heard theres a control for the comm port thats made for vb.netcan anyone point me in that directon if such a new control exists

Here is the code I am having trouble with:

Const COM_PORT = 1 'com port to be used // text1 is a label

Private Sub Form_Load()

With Me ' Initialise Application

Me.Text = "Receiving from PICAXE on COM" + LTrim$(Str$(COM_PORT))

End With

With text1 ' Initialise the TextBox

text1.Left = 0

.Text = ""

.Top = 0

End With

With MSComm1 ' Initialise the Serial Port

.CommPort = COM_PORT

.Handshaking = 0

.RThreshold = 1

.Settings = "2400,N,8,1"

End With

With MSComm1 ' Open the Serial Port

.PortOpen = True

End With

End Sub

Private Sub Form_Resize()

With text1

.Width = 200

.Height = 200

End With

End Sub

Private Sub MSComm1_OnComm()

Dim rxData$

With MSComm1

Select Case .CommEvent

Case comEvReceive '<-------------------error

rxData$ = .Input

With text1

.SelStart = Len(.Text) '<-------------------error

.SelLength = 0 '<-------------------error

.SelText = rxData$ '<-------------------error

End With

End Select

End With

End Sub



Answer this question

Whats wrong with this code.... receiving data from com

  • Whats wrong with this code.... receiving data from com