[Gambas-user] Convert string to integer

Ru Vuott vuott at ...325...
Mon Jan 27 19:28:50 CET 2014


..try:

    qrg_i = CInteger(Val(qrg))




--------------------------------------------
Lun 27/1/14, Dirk <yodi at ...18...> ha scritto:

 Oggetto: Re: [Gambas-user] Convert string to integer
 A: gambas-user at lists.sourceforge.net
 Data: Lunedì 27 gennaio 2014, 18:11
 
 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
 
 
 
 
 
 
 ------------------------------------------------------------------------------
 CenturyLink Cloud: The Leader in Enterprise Cloud Services.
 Learn Why More Businesses Are Choosing CenturyLink Cloud
 For
 Critical Workloads, Development Environments &
 Everything In Between.
 Get a Quote or Start a Free Trial Today. 
 http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
 _______________________________________________
 Gambas-user mailing list
 Gambas-user at lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user





More information about the User mailing list