I've come across a weird bug I can't solve. I have a list of Controls that are in a panel, and each control has an up arrow (move up) button. This will swap the control's location with the one above it with the following code:
curControl = parent.dataControls[EntryIDNum]; //is 1
swapControl = parent.dataControls[EntryIDNum - 1]; //is 0
tempID = curControl.EntryIDNum;
tempPnt = curControl.Location;
curControl.Location = swapControl.Location;
curControl.EntryIDNum = swapControl.EntryIDNum; //is now 0
swapControl.Location = tempPnt;
swapControl.EntryIDNum = tempID; //is now 1
Say my list has 5 controls. If I move control 4 up one, it swaps with control 3 no problem.
However, if I move the last control (number 5) up, the
curControl.Location = swapControl.Location
happens backwards. For example:
//curControl.Location = (5, 333)
//swapControl.Location = (5, 157)
curControl.Location = swapControl.Location;
//curControl.Location = (5, 333)
//swapControl.Location = (5, 333)
This is IF AND ONLY IF I'm moving up the last control in my list. All other controls swap with the other control with no problem.
Let me know if there is anymore info needed.