Author Topic: Convert String to Integer  (Read 130 times)


  • Full Member
  • ***
  • Posts: 215
    • View Profile
Convert String to Integer
« on: January 26, 2017, 03:03:52 pm »
I'm trying to convert a string to an Integer

Page 91 of the guide gives this function for object type String:

Code: [Select]
Public Function ToInteger(Hex As String) as Integer

But I can't get it to work ("Undefined Function"), and I don't know what Hex is supposed to be (some kind of formatting string I assume).

Im using

Code: [Select]
Integer.TryConvert(motionStopTime, stopInt)

Instead. Anyone know the syntax for converting a String to an Integer?


Share on Facebook Share on Twitter


  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: Convert String to Integer
« Reply #1 on: January 31, 2017, 06:38:24 pm »
Code: [Select]
        Dim stopInt As Integer = -1
        If Integer.TryConvert("100", stopInt) Then
            //Success Variable stopInt contains 100
            // Failure stopInt contains -1
        End If

It does not handle hex values like "0x64" though