Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CheckListBox not refreshing

Status
Not open for further replies.

Gixonita

IS-IT--Management
Joined
Oct 17, 2005
Messages
103
Location
US
Hi,

I have a checklistbox that has a list of reports (that come from my database), then I verify which reports are assigned to a userID, then I want to "check" all those reports in the checklistbox. My problem comes with the fact that after programatically "checking" the items the checklistbox will not display a checkmark next to the reports.

int index = 0;
foreach (ReportClass Report in ReportList)
{
if (Report.AccessGranted == 1)
{
clbReports.SetItemChecked (index, true);
clbReports.SetItemCheckState (index,CheckState.Checked);
}
index ++;
}
clbReports.Refresh ();

Anyone has any idea why the checkmarks do not appear ?

Thanks in advance

Luis Torres
 
I'll be honest with you - the checked list box is an old control. If you can - I would switch to the listview and set the CheckBoxes property to true.

Then you could say lstReports.Items[index].Checkd = true;

and you're done.

A list view contains listviewitems. you can set the individual properties of a listviewitem and include a tag which is also handy.
 
Thank you JurkMonkey, I'll try your recomendation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top