我使用的.NET Framework 1.0,我嘗試將字符串轉換爲int,但拋出一個錯誤輸入字符串是不是在正確的格式VB.NET字符串轉換成int拋出錯誤:輸入字符串的不正確的格式
在我的代碼,看看
Dim Total As Integer
Total = (Convert.ToInt32(Me.lblOldQty.Text)) - (Convert.ToInt32(Me.txtQty.Text))
Dim Value As String = Me.lblOldQty.Text + " - " + Me.txtQty.Text + " = " + Convert.ToString(Total)
Me.lblNewValue.Text = Value
我已經使用目標類和Integer.Parse嘗試,但相同的結果。
任何幫助,將不勝感激
你需要問自己: *「什麼是[整數](http://en.wikipedia.org/wiki/Integer)?」*一旦你知道這個問題的答案,你就會知道爲什麼這個錯誤是在表單加載:**一個空蕩蕩的ing不是一個整數!** –
另請參閱[String.IsNullOrEmpty](https://msdn.microsoft.com/en-us/library/system.string.isnullorempty%28v=vs.80%29.aspx)。它的.Net 2.0。也許你應該使用.Net 2.0或提供類似的功能。 – jww