Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim separator As Char = ","c Dim allIIDs As New List(Of Int32) If TextBox1.Text.Length <> 0 Then For Each strNum As String In TextBox1.Text.Split(separator) Dim num As Int32 If Int32.TryParse(strNum, num) Then allIIDs.Add(num) End If Next End If allIIDs.Sort() For Each control As Control In Panel1.Controls If TypeOf control Is CheckBox Then Dim chk As CheckBox = DirectCast(control, CheckBox) chk.Checked = allIIDs.BinarySearch(Int32.Parse(chk.Text)) > -1 End If Next End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)