为checkedListBox赋值并 遍历checkedListBox中选中的值

//赋值

 CLBDJZLS.Items.Clear();
            DataTable dtdjzl = Service.getTableBySql("SELECT * from talbe");
            foreach (DataRow dr in dtdjzl.Rows)
            {
                CLBDJZLS.Items.Add(dr["登记种类"].ToString());
            }

//遍历

for(int i=0;i<CLBDJZLS.Items.Count;i++)
{
        if (CLBDJZLS.GetItemChecked(i))
        {
          string value=CLBDJZLS.GetItemText(CLBDJZLS.Items[i]);
        }
}

posted on 2013-01-31 14:19  MyBeN  阅读(3441)  评论(0编辑  收藏  举报

导航