AnalyticsUnlimited.Client_WPF.DGValuesForm.moveUp_Click C# (CSharp) Method

moveUp_Click() private method

private moveUp_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void moveUp_Click(object sender, EventArgs e)
        {
            int curindex = ValLstBox.SelectedIndex;//ValLstBox.Items.IndexOf(LabeltextBox.Text);//
            string selecteditem = getItemAtIndex(curindex);
            if (curindex > 0)
            {
                ValLstBox.Items.RemoveAt(curindex);//selected removed

                ValLstBox.Items.Insert(curindex, getItemAtIndex(curindex-1));//shifting above item one step down
                ValLstBox.Items.RemoveAt(curindex - 1);

                ValLstBox.Items.Insert(curindex - 1, selecteditem);
                ValLstBox.SelectedIndex = curindex - 1;
            }
        }