0

I was trying to delete the currently selected listview item using MFC methods, but obviously they werent compatible

How can I accomplish this in VS 2005 (standard .NET windows forms NOT MFC?

I have tried

void CMyListView::DeleteSelectedRow()
{
  int nIndex = GetListCtrl().GetSelectionMark();

  if(nIndex != -1)
  {
    GetListCtrl().DeleteItem(nIndex);
  }
}

Thanks in advance

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by That Asian Guy
0

That might be what you are looking for

//C++ 2005
	private: void DeleteIt()
	{
	    if (listView1->SelectedItems->Count>0)
  	        listView1->Items->RemoveAt(listView1->SelectedIndices [0]);
	}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.