[英]Visual basic 2010 Error
I keep getting an error on fee.ToString("C") when trying to run the code.尝试运行代码时,我不断收到关于 fee.ToString("C") 的错误。 The error I keep getting is Value of type 'String'cannot be converted to 'System.Windows.Forms.Textbox'.
我不断收到的错误是“字符串”类型的值无法转换为“System.Windows.Forms.Textbox”。 Not sure what I am doing wrong any help I could get would be greatly appreciated.
不确定我做错了什么,我将不胜感激。 My code is below.
我的代码如下。
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
amountDueTextBox.Text = fee.ToString("C")
try this. amountDueTextBox.Text = fee.ToString("C")
试试这个。 Your trying to assign a textbox to a string.您尝试将文本框分配给字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.