I have a winform and in it I have a List of MyController Object.
List<MyController> _myController = new List <MyController>();
This mycontroller object contains 1 checkbox 4 textbox and 1 button on each line.
What I want is when I click a button in a row, I want that whole row to move up and the row on the upper side will automatically move to down.
How can I write a code for that in C#?
In the buttonClick function I tried the following but apparently it does not work:
private void downButton_Click(object sender, EventArgs e)
{
string NameSet = (sender as Button).Name.Split(new char[] { '_' })[1];
int itemNo = Int32.Parse(NameSet);
MyControls tempObj = new MyControls();
if (itemNo>0)
{
tempObj = _myControls[itemNo];
_myControls[itemNo] = _myControls[itemNo - 1];
_myControls[itemNo - 1] = tempObj;
}
}
probably I need to do this change via pointers and references. But how can I reflect this change in my active form?