This is how a checkedlistcontrol is populated:

chklstUserRoles.DataSource = dsUsersAndRoles.Tables("Roles").DefaultView
chklstUserRoles.DisplayMember = "Name"
chklstUserRoles.ValueMember = "RoleID"

I would like to loop through a checkedlistBox control and collect the IDs that is allocated to each checked item in the control.

This does not quite work:

Dim i As Integer
For i = 0 To chklstUserRoles.CheckedItems.Count - 1
strRoleIds += chklstUserRoles.SelectedValue.ToString() + ","
Next i 'strRoleIds += chklstUserRoles.CheckedItems[i].ToString() + ",";

Thanks