我试图在按下按钮时将信息从文本框从一种形式转移到另一种形式,但出现此错误“ BC30311 Visual Basic AND VB.NET类型'String'的值不能转换为'文本框'。”谁能帮我。代码在下面。
Private Sub BtnInvoice_Click(sender As Object, e As EventArgs) Handles BtnInvoice.Click
'Shows the Invoice form and transfers information into it'
Invoice.Show()
Invoice.TxtHours1 = TxtLabour.Text
Invoice.TxtTravel1 = TxtTravel.Text
Invoice.TxtPlastic1 = TxtPlastic.Text
Invoice.TxtCopper1 = TxtCopper.Text
Invoice.TxtChrome1 = TxtChrome.Text
Invoice.TxtDiscount = TxtDiscount.Text
Invoice.TxtTotal = TxtTotal.Text
答案 0 :(得分:0)
您无法将字符串分配给TextBox,需要设置TextBox的Text属性:
Private Sub BtnInvoice_Click(sender As Object, e As EventArgs) Handles BtnInvoice.Click
'Shows the Invoice form and transfers information into it'
Invoice.Show()
Invoice.TxtHours1.Text = TxtLabour.Text
Invoice.TxtTravel1.Text = TxtTravel.Text
Invoice.TxtPlastic1.Text = TxtPlastic.Text
Invoice.TxtCopper1.Text = TxtCopper.Text
Invoice.TxtChrome1.Text = TxtChrome.Text
Invoice.TxtDiscount.Text = TxtDiscount.Text
Invoice.TxtTotal.Text = TxtTotal.Text