vb中有没有回车后自动加一项,再回车再加一项的控件。这样我可以一次性输入很多项内容。如有个订单20项,一次性可以输入很多个。

解决方案 »

  1.   

    Dim i As Integer = 0
        Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
            If e.KeyChar = ChrW(13) Then
                i = i + 1
                Dim txt As New TextBox
                txt.Location = New Point((i Mod 10) * txt.Width, (i \ 10) * txt.Height)
                Me.Controls.Add(txt)
            End If
        End Sub