Quote Originally Posted by AamirKhan View Post
Hello , i am new to VB 6.0 and the code i am working on works on sigle data type and i am using serial communication that send me ascii numbers and i need to convert the ascii to single. The Code is :



Private Sub WithoutGE_Click()
Dim serialflag As Boolean
Dim serportname As String

If MSComm1.PortOpen Then
MSComm1.PortOpen = False
End If

MSComm1.CommPort = 5 'Defined COM port available on PC
MSComm1.InputLen = 1
MSComm1.Settings = "115200, N, 8, 1"
MSComm1.PortOpen = True


End Sub

Private Sub MSComm1_OnComm() 'on serial event


If (MSComm1.CommEvent = comEvReceive) Then ' if something received
'serialData = MSComm1.Input shows me data type is byte i have mismatch error
'serialdata is variant error is not observed

serialByteData = MSComm1.Input
End If
End Sub


What should i do need help . Ascii to Byte and Byte to single ! but how !???
AamirKhan, reading back over this code begs the question: Is this code exactly the code in your app? If it is; serialBytedata will be read and flushed upon receipt of each char! You will never retrieve the whole number.

Also, why are you naming the input "serialBytedata" when, as you say, you're receiving string data? Reading over this post can be very confusing.