Pretty self explanatory. I would like to change a string if a certain option is checked in the checkedListBox. And change it again when a different option is checked. I'd say that a if statement would work but how would I do that inside a if statement so that other objects can use that string?
You could make the string a constant and assign a value to it in the checkedListBox's SelectedIndexChanged event. Something like (pseudocode):
private readonly String clbResponse = String.Empty;
. . .
protected void clb_SelectedIndexChanged(object sender, eventargs e)
{
int indexSelected = clb.SelectedIndex;
case (indexSelected)
0:
clbResponse = "index 0 was selected";
break;
1:
clbResponse = "index 0 was selected";
break;
. . .
default
break;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.