生成文本框动态错误

时间:2013-12-04 11:01:02

标签: vb.net

我正在使用此代码通过编程方法生成文本框,使用vb.net并且我收到此错误

 Dim txt1 As TextBox
 Dim i As Integer = 0
 While i < 5

        txt1 = New TextBox()
        txt1.ID = "myTextBox" + i

        Panel1.Controls.Add(txt1)
        Dim lit As New Literal()
        lit.Text = "<br><br>"
        Panel1.Controls.Add(lit)
        System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)

    End While

错误

enter image description here

1 个答案:

答案 0 :(得分:0)

这是VB吧?

不应该这样:

txt1.ID = "myTextBox" + i

是:

txt1.ID = "myTextBox" & i

字符串连接。