A beginner question here. I'm trying to run this code. I kinda want to alter the order of another array into this new array. However, I get error System.IndexOutOfRangeException: 'Index out of bound from array'
I don't really know what to do or what did I do wrong.
public partial class Form3 : Form
{
public string[] arrayJugadores = new string[3];
Form2 FormRegistro = new Form2();
public Form3()
{
InitializeComponent();
Random randomizador = new Random();
int valor = randomizador.Next(1, 15);
if (valor == 1)
{
arrayJugadores[0] = FormRegistro.listaJugadores[0];
arrayJugadores[1] = FormRegistro.listaJugadores[1];
arrayJugadores[2] = FormRegistro.listaJugadores[2];
arrayJugadores[3] = FormRegistro.listaJugadores[3];
}
else if (valor == 2)
{
arrayJugadores[0] = FormRegistro.listaJugadores[3];
arrayJugadores[1] = FormRegistro.listaJugadores[0];
arrayJugadores[2] = FormRegistro.listaJugadores[1];
arrayJugadores[3] = FormRegistro.listaJugadores[2];
}