Public Class Form1
Private Function OrderCheckBox(ByVal panelName As String) As String
Dim i As Integer = 0
Dim szText As String = String.Empty
Dim test As Panel = Me.Panel1
Dim control2 As Control
For Each control2 In test.Controls
Dim chebox As CheckBox = CType(control2, CheckBox)
If chebox.Checked = True Then
i = i + 1 //选中后加序号
szText += i.ToString() + chebox.Text.Trim() + ";"
End If
Next
Return szText
End Function
Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown
TextBox1.Text = OrderCheckBox("Panel1")
End Sub
End Class