1. initialize the control
Listview1.items. Clear ();
Listview1.columns. Clear ();
Columnheader CH = new columnheader ();
Ch. width = 100;
Ch. Text = "terminal ";
Listview1.columns. Add (CH );
Columnheader CH2 = new columnheader ();
Ch2.width = 100;
Ch2.text = "switch status ";
Listview1.columns. Add (CH2 );
Listview1.view = view. details;
Listview1.gridlines = true;
Listview1.fullrowselect = true;
String [] STRs = txtconcode. Text. Split (',');
For (INT I = 0; I <STRs. length; I ++)
{
Listviewitem LVI = new listviewitem ();
LVI. Text = STRs [I];
LVI. subitems. Add (" ");
Listview1.items. Add (LVI );
}
2. Click the checkbox value to modify the corresponding value.
Private void listviewincluitemchecked (Object sender, itemcheckedeventargs E)
{
For (INT I = 0; I <listview1.items. Count; I ++)
{
If (listview1.items [I]. Checked = true)
{
Listview1.items [I]. subitems [1]. Text = "Opening ";
}
Else
{
Listview1.items [I]. subitems [1]. Text = "";
}
}
}
Click checkbox in listview to modify the value.