Is there any way to override GetItemCheckState(i) from CheckedListBox? I'm trying to make a class to have a custom CheckedListBox that works the exact same, but when I call GetItemCheckState(i) instead of returning string Checked or Unchecked I want it to return bool true or false.
Visual Studio tells me that the override modifier is not valid for this item, is there any way around this?
[Edit] I found a workaround, but I'm not sure if it will cause some sort of issue and I dunno if it's the most elegant solution, so almost same question still, there is a better workaround for this?
What I did:
public class ExCheckedListBox : CheckedListBox
{
public bool GetItemCheckState2(int index)
{
string aux = (this.GetItemCheckState(index)).ToString();
if(aux == "Checked")
{
return true;
}
else if(aux == "Unchecked")
{
return false;
}
return false;
}
}
As LarsTech and Ben Voigt said,
GetItemChecked(#)orGetItemCheckState(index) != CheckState.Unchecked;solves my issue.