public AsociarUserASprint(int idSprintP) { idSprint = idSprintP; InitializeComponent(); panel1.AutoScroll = true; listaUserS = ConexionMetodos.GetListaUserSNombre(idSprint); listaUserID = ConexionMetodos.GetListaUserSId(idSprint); Button btn; //int colum = 15; int j = 0; int i = 0; int nombre = 0; for (j = 0; j < listaUserS.Count; j++) { btn = new Button(); nombre += 1; btn.Name = "E" + listaUserID.ElementAt(j); btn.Text = listaUserS.ElementAt(j); btn.Location = new System.Drawing.Point(88 * (j % 6), 50 * (i % 6)); btn.Size = new System.Drawing.Size(88, 50); btn.Click += new EventHandler(button_Click); btn.BackColor = Color.LightGray; panel1.Controls.Add(btn); if ((j % 6) == 5) { i++; } } }