[Gambas-user] Convert string to integer

Dirk yodi at ...18...
Mon Jan 27 18:11:21 CET 2014


Hi,

I'm having a problem with Convert string to integer


 

Public Sub MySock_Read() ' Data via Telnet
  ' When some data arrives from the remote
  ' part of the socket, "DataAvailable" event
  ' is raised
  '****************************************

Dim qrg_i As Integer
Dim qrg As String
Dim rx, rx2, rxtmp As String

If MySock.Status = Net.Connected Then
      Read #MySock, rx, Lof(MySock)
      rx2 = rx

If Mid$(rx, 1, 5) = "DX de" Then

dxde = Mid$(rx, 1, 5)
         rx = Trim(Replace$(rx, "DX de ", ""))
         i = InStr(rx, " ")
        txcall = Mid$(rx, 1, i)
         rx = Trim(Replace$(rx, txcall & " ", ""))
        qrg = Mid$(rx, 1, InStr(rx, " "))
         rx = Trim(Replace$(rx, qrg & " ", ""))
        dxcall = Mid$(rx, 1, InStr(rx, " "))
         rx = Trim(Replace$(rx, dxcall & " ", ""))
' . . . . . . . . . .

 qrg = Trim(qrg)

 Print "qrg=" & qrg & "<<<"  '  out =  qrg=14160.0<<<

Try qrg_i = CInteger(qrg)
 If Error Then Error Subst("&1 won't convert", qrg)
 qrg_i = CInteger(qrg) '  <<<== Here is Error   
  
---
Dirk









More information about the User mailing list