is there an event where when the listview box is updated/changed i can call a function where i can do some calculations on the changed data.
the listview is updated from textboxes and a button and the calculated result is shown in a text box
You populate listView on clicking on a button, if I understand you well. So no need to use a listView even to do something with the data from it. Simply create another method for calculations which will be called just after listView population, and it will look something like it:
private void button1_Click(object sender, EventArgs e)
private void ListViewPopulating()
string a = textBox1.Text;
string b = textBox2.Text;
//and so on
//and listView actual population
private void Calculations()
for (int i = 0; i < listView1.Items.Count; i++) //row by row!
string a1 = listView1.Items[i].Text; //value in 1st column
string a2 = listView1.Items[i].SubItems.Text; //value in 2nd column
//and so on...
//this is how you retrive the values from listView, and use them to do the calculations!
If there is anything you would like to know, please go ahead and ask.
great. thanks m8. i did try that but got an error about it only working with integers and not string | string . so i'v ended up doing
if (txtItem.Text.Length == 0)
MessageBox.Show("Please Enter an Item name");
if (txtCost.Text.Length == 0)
MessageBox.Show("Please Enter a Cost");
if (!double.TryParse(txtCost.Text, out Num))
MessageBox.Show("Cost needs to be a number");
this seems to work ok for me. thanks anyway. the opperators are slightly different from what i remember from vb.
im marking this as solved now thanks. speak to you again soon no doubt. l8rs