SoFunction
Updated on 2025-03-07

C# Example of adding and deleting operations using listView

private void addButton_Click(object sender, EventArgs e)
{
string item1Str = ();//First column text
string item2Str = ();//The second column of text
this.(new ListViewItem(new string[] { item1Str, item2Str }));//Add a line
coutNumber++;//Increment of the number of rows of listView
}
 
private void delButton_Click(object sender, EventArgs e)
{
    foreach (ListViewItem item in )
    {
        if ((item))
        {
            int indexDel = ();
            if ( != 0)
            {
(indexDel);//Delete
            }
        }
    }
}