Hello ,
I have a List of Buttons and a List of NumericUpDown.
- numUpDnList = new List();
- btnList = new List();
- for (int i = 0; i < maxv; i++)
- {
- Button btn = new Button();
- btn.Location = new Point(121, 275 + i * 19);
- this.Controls.Add(btn);
- btnList.Add(btn);
-
- NumericUpDown numUpDn = new NumericUpDown();
- numUpDn.Location = new System.Drawing.Point(120, 275 + i * 19);
-
- this.Controls.Add(numUpDn);
- numUpDnList.Add(numUpDn);
- }
I want to: btnList[i].Click += (se, ev) => { numUpDnList[i].UpButton(); }
But it doesn't work :
" System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index' "