-1
嘗試運行代碼時,我不斷收到有關fee.ToString(「C」)的錯誤。我一直得到的錯誤是'String'類型的值無法轉換爲'System.Windows.Forms.Textbox'。不知道我在做什麼錯我可以得到任何幫助將不勝感激。我的代碼如下。Visual basic 2010錯誤
Private Sub calcButton_Click(sender As Object, e As EventArgs) Handles calcButton.Click
Try
Dim bailInt As Integer
Dim collItem As String
Dim fee As Decimal = CDec(0.0)
'Convert input to values
bailInt = Integer.Parse(bailAmountTextBox.Text)
collItem = collateralTextBox.Text
'Calculate 10% fee on bail amount
fee = CDec(0.1 * bailInt)
'Display Messagebox with fee amount
amountDueTextBox = fee.ToString("C")
Catch ex As Exception
MessageBox.Show("Must be numeric data", "Bad Data", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
With bailAmountTextBox
.Focus()
.SelectAll()
End With
End Try
End Sub
謝謝你不能相信我錯過了。 – Aaron