Answered by:
VB6 - Can't convert Received data to Hex

Question
-
I'm using Visual Basic 6.0
I can output hex data ok to my device via the serial port and it responds by sending a hex packet back. I can see the hex
being received by my computer via a comport monitor program.
When I try to convert this data to hex I get a type 'mismatch error'
Private Sub Form_Load()MSComm1.InputLen = 1
MSComm1.PortOpen = TrueEnd Sub
Private Sub Command1_Click()Dim StrOut As Variant
'sends StrOut to DUT
'**********************************
StrOut = Chr(&H24) & Chr(&HDB) & Chr(&H0) & Chr(&H0) _
& Chr(&H1) & Chr(&H4) & Chr(&HF7) & Chr(&H75)
MSComm1.Output = StrOutb1 = MSComm1.Input
b2 = MSComm1.Input
b3 = MSComm1.Input
b4 = MSComm1.Input
b5 = MSComm1.Input
b6 = MSComm1.Input
b7 = MSComm1.Input
b8 = MSComm1.Input
b9 = MSComm1.Input
b10 = MSComm1.Input
b11 = MSComm1.Input
b12 = MSComm1.Input
b13 = MSComm1.Input
b14 = MSComm1.Input
b15 = MSComm1.Input
b16 = MSComm1.Input
b17 = MSComm1.Input
b18 = MSComm1.Input
b19 = MSComm1.Input
b20 = MSComm1.Input
b21 = MSComm1.Input
b22 = MSComm1.Input
b23 = MSComm1.Input
b24 = MSComm1.Input
b25 = MSComm1.Input
b26 = MSComm1.Input
Text1.Text = Hex(b1)End Sub
Private Sub Command2_Click()Text1.Text = ""
End Sub
Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False
End Sub
Wednesday, September 6, 2006 7:57 PM
Answers
-
Sorry but these forums are for VB.NET. VB6 is unsupported now and there is no support.
Best place to ask VB6 questions would be the appropriate communities:
Wednesday, September 6, 2006 8:21 PM -
These forums are for VB.NET and there are better places to find answers for older versions of VB. Maybe the
VB6 newgroups - http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.vb.general.discussion&lang=en&cr=US
Or perhaps the VB6 resource center
http://msdn.microsoft.com/vbrun/or perhaps www.vbcity.com may be useful places to search for answers on VB6 related questions.
Hopefully this helps.
Wednesday, September 6, 2006 8:29 PM
All replies
-
Sorry but these forums are for VB.NET. VB6 is unsupported now and there is no support.
Best place to ask VB6 questions would be the appropriate communities:
Wednesday, September 6, 2006 8:21 PM -
These forums are for VB.NET and there are better places to find answers for older versions of VB. Maybe the
VB6 newgroups - http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.vb.general.discussion&lang=en&cr=US
Or perhaps the VB6 resource center
http://msdn.microsoft.com/vbrun/or perhaps www.vbcity.com may be useful places to search for answers on VB6 related questions.
Hopefully this helps.
Wednesday, September 6, 2006 8:29 PM