I have a listView, in 1st column is are article names, in 2nd column are prices of these articles (data type of float).
And I have checkBoxes. What I would like to do, is to count the prices in 2nd column of all selected rows.
And then the counted value to show in a tectBox.
How can I do that?
This is what I did, but I dont know how to count them?
for (int i = 0; i < listView1.Items.Count; i++)
{
if (listView1.Items[i].Checked)
{
//when row checked is has to count here
//textBox1.Text += listView1.Items[i].SubItems[1].Text;
}
}
But this is not working correctly. It does not count prices together when selected the row.
And one more thing. Which method to use that the chekced rows will count in a real time.
An event handler "ItemCheck" it does not do that. It count the previous checked row when another is checked - so one step behind.