"Padu"
I've been searching the newsgroup for an answer but probably with the
wrong keywords...
Imagine that I have a ListView with some items and the listview view is
Details. How do I move an item up or down the list?
Cheers
Padu
Ok, that's how I've done it:
private void mniEditUp_Click (object sender, EventArgs e)
{
if (!AreThereSelec tedItems()) return;
//we want to insert one position above, if not the first one
if (SelectedItem() .Index 0)
{
int idx = SelectedItem(). Index - 1;
ListViewItem item = (ListViewItem)S electedItem().C lone();
SelectedItem(). Remove();
ListViewItem inserted = lvwCommands.Ite ms.Insert(idx, item);
inserted.Select ed = true;
inserted.Focuse d = true;
RefreshListEdit GUICommands();
}
}
I don't know if it's the best way to do it, but it works...
Cheers
Padu