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

后端 未结 7 1063
死守一世寂寞
死守一世寂寞 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:34

    Please try this, VB.NET 2010:

    1. Integer.TryParse(txtPrice.Text, decPrice)
    2. decPrice = Convert.ToInt32(txtPrice.Text)

    From Mola Tshepo Kingsley (WWW.TUT.AC.ZA)

提交回复
热议问题