C# Editable ListView
| Download : Source , Executable | |
|
Based on the similar techique used my previous article , the Editable Listbox , we can edit columns and rows of a listview control. We can overlay editbox to edit item , or combobox to enable item selection from a list into a listview. |
|
|
|
![]() |













Hello,
Thanks for the article. However, I found a small bug in the code. The editing does not work properly when resizing the columns.
It is caused by the first columnwidth being counted twice (line before the for(…)) It should for instance be like this:
int epos = 0;
for (int i = 0; i spos && nStart < epos) { subItemSelected = i; break;
}
spos = epos;
}
Hi,
Small correction (I was trying to edit column 2 only so missed a small mis-numbering). I cannot delete previous replies, so you may combine these replies if you like.
Int32 subItemSelected = -1; //Assume No SubItem to be selected.
for (Int32 i = 1; i spos && nStart spos && nStart < epos)
{
subItemSelected = ((ListView)sender).Columns.Count – 1;
}
if (subItemSelected == -1)
{
return;
}