Question regarding CheckedListBox.GetItemCheckState

Hi Reddit, I've got a (probably) very simple question; I'm making my first webpage in ASP.NET (Framework 4.5.2) using C# in Visual Studio 2015. I want to loop through the checked states of my checkboxes in my CheckedListBox using GetItemCheckState like this:

for (int i = 0; i < chBoxListTables.Items.Count; i++)
{
if (chBoxListTables.GetItemChecked(i))
{
string str = (string)chBoxListTables.Items[i];
MessageBox.Show(str);
}
}

But when I try to use GetItemChecked Visual Studio doesn't show the option, and returns an error when I try to execute the code. Does anyone know why I can't use this? Am I missing an assembly reference?

Thanks in advance.

by ThrowmeawayCeeSharp via /r/csharp

Leave a Reply