locked
Is there any function to convert string to integer in VB.net? RRS feed

  • Question

  • User216680051 posted

    Is there any function to convert string to integer in VB.net?

    thank you very much.

    Wednesday, July 4, 2007 7:17 PM

Answers

  • User-989915499 posted

    Hi There,

    You can do this

    Dim Val as String = "50"

    Dim i As Integer = Convert.ToInt32(Val)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 4, 2007 8:28 PM

All replies

  • User-989915499 posted

    Hi There,

    You can do this

    Dim Val as String = "50"

    Dim i As Integer = Convert.ToInt32(Val)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 4, 2007 8:28 PM
  • User216680051 posted

    thank you very much dennis

    Wednesday, July 4, 2007 8:35 PM
  • User-989915499 posted

    Hi There,

    No problem, always welcome.

    You can use static function in class Convert to convert most type in vice versa.

    Alternatively, you can use CType

    Protected sub MyButton_Click( ByVal sender as Object, ByVal e As EventArgument ) Handles MyButton.Click

    Dim senderButton As Button = CType(sender, Button) 'This will convert object to Button type

    End Sub

    Wednesday, July 4, 2007 9:08 PM
  • User-2075970516 posted

    could you use Cint

    Tuesday, May 27, 2008 1:41 PM