private void listView1_ItemCheck(object sender, ItemCheckEventArgs e)
{
textBox1.ResetText();
foreach (ListViewItem lvi in listView1.Items)
{
if (lvi.Checked == true)
{
textBox1.AppendText(lvi.Text);
}
}
}
I think what I am trying to do there is obvious, but the result is that the listboxitem that I just click is not displaying in the textBox. It’s displayed after I check an other one (or uncheck the same one).
Any help?
Use the
ItemCheckedevent instead of theItemCheckevent (the latter is raised before the check state changes on the item, and this is why you only see its effect after checking another item).