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
thanks
steve

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)
{
    ListViewPopulating();
    Calculations();
}

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[1].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.
bye,
Mitja

sweet. thats exactly what i was looking for. there is another thing.
is there an andor command?
i want to do something like

if (textbox1.text != "" andor textbox2.text != "")
{bla bla bla code
}else {
messagebox.show("fill boxes!");}

thanks mitja

sure,
AND = &&
OR = ||
So you can write it like:

if(textBox1.Text != "" && textBox2.Text != "")
{
    //is both are empty, code will go in here
}
if(textBox1.Text != "" || textBox2.Text != "")
{
    //is any of textoxes is empty, code will go in here
}

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");
                return;
            }

            if (txtCost.Text.Length == 0)
            {
                MessageBox.Show("Please Enter a Cost");
                return;
            }

            double Num;
            if (!double.TryParse(txtCost.Text, out Num))
            {
                MessageBox.Show("Cost needs to be a number");
                return;
            }

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

YOu can alse try:

if(!String.IsNullOrEmpty(textBox1.Text))
{
   //is its not null and not empty!
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.