int indexs = (listview_urls.SelectedItems[0].Index) - 1;
if (indexs > -1)
{
string s = listview_urls.SelectedItems[0].SubItems[1].Text;
string S2 = listview_urls.Items[indexs].SubItems[1].Text;
listview_urls.SelectedItems[0].SubItems[1].Text = S2;
listview_urls.Items[indexs].SubItems[1].Text = s;
ListViewItem tmp = new ListViewItem();
tmp.SubItems.Add(S2);
tmp.SubItems.Add(s);
ListViewItem nextItem = listView_Scheduler.Items[indexs];
nextItem.Selected = true;
listView_Scheduler.Items[indexs + 1].Selected = false;
listView_Scheduler.Focus();
listView_Scheduler.Refresh();
}
else
{
MessageBox.Show("Sorry!Can't move further upward");
}
Downward Direction:
int indexs = (listview_urls.SelectedItems[0].Index) + 1;
if (indexs < listview_urls.Items.Count)
{
string s = listview_urls.SelectedItems[0].SubItems[1].Text;
string S2 = listview_urls.Items[indexs].SubItems[1].Text;
listview_urls.SelectedItems[0].SubItems[1].Text = S2;
listview_urls.Items[indexs].SubItems[1].Text = s;
ListViewItem tmp = new ListViewItem();
tmp.SubItems.Add(S2);
tmp.SubItems.Add(s);
ListViewItem nextItem = listView_Scheduler.Items[indexs];
nextItem.Selected = true;
listView_Scheduler.Items[indexs - 1].Selected = false;
listView_Scheduler.Focus();
listView_Scheduler.Refresh();
}
else
{
MessageBox.Show("Sorry!Can't move further Downward");
}