LISTVIEW控件怎么删除末尾的一行,或删除中间选定的一行
----------------------------
'选定一行
With lvw1
.ListItems.Remove (.SelectedItem.Index)
End With
listview1.Items.remove(listview1.selectedItems[0]);
item的方法items.remove(item);
参数是 项item
'尾行
With lvw1
.ListItems.Remove (.ListItems.Count)
End With
//
private void 删除itemToolStripMenuItem_Click(object sender, EventArgs e)
{
if (listView1.SelectedItems.Count == 0)
{
MessageBox.Show("没有");
}
else
{
string constr = "Data Source=EBCF5EA27E834E1;Initial Catalog=MySchool;Integrated Security=True";
SqlConnection connection = new SqlConnection(constr);
string sql =string .Format( "delete from grade where gradeid