How do I convert from a string to an integer in Visual Basic?

后端 未结 7 1060
死守一世寂寞
死守一世寂寞 2020-12-15 15:06

How do I convert from a string to an integer? Here\'s what I tried:

Price = CInt(Int(txtPrice.Text))

I took out the Int and I

7条回答
  •  生来不讨喜
    2020-12-15 15:29

    You can try these:

    Dim valueStr as String = "10"
    
    Dim valueIntConverted as Integer = CInt(valueStr)
    

    Another example:

    Dim newValueConverted as Integer = Val("100")
    

提交回复
热议问题