I have a NumericUpDown and I need that every time I change the value, I show in a textbox a List that I already have predefined. I have this code in the numericUpDownClients_ValueChanged, but I get exception from System.ArgumentOutOfRangeException.
Thanks !!
private void numericUpDownClientes_ValueChanged(object sender, EventArgs e)
{
if (numericUpDownClientes.Value == 0)
{
tsbGuardar.Enabled = false;
}
if (numericUpDownClientes.Value == 1)
{
tsbGuardar.Enabled = false;
txtNombreClientes.Text = listClientes[0].getNombre();
txtApellidosClientes.Text = listClientes[0].getApellidos();
mtxtFechaClientes.Text = listClientes[0].getFecha();
mtxtNifClientes.Text = listClientes[0].getNif();
txtDireccionClientes.Text = listClientes[0].getDireccion();
mtxtCodPostClientes.Text = listClientes[0].getCodigoPost().ToString();
}
}
tsbSave is a button.
The ones that start with Txt are TextBox and the ones that start with mtxt are MaskedTextBox.
The list is of objects of a Client class, in which I have defined the constructors and the setters and getters.
Cliente c1 = new Cliente(1, "Pepe", "Lopez Ruiz", "21/05/1997", "65230147-
J", "C/Mayor 23", 2657);
Cliente c2 = new Cliente(2, "Juan", "Fernandez Polo", "07/11/2000",
"09086644-W", "C/Picasso 3", 28813);
Cliente c3 = new Cliente(3, "Carmen", "Cuenca Olmo", "18/10/1996",
"463017527-M", "C/Aves 25", 24103);
Cliente c4 = new Cliente(4, "Ana", "Ruiz Dominguez", "01/01/1967",
"68423671-T", "Avda. Constitucion 83", 26681);
Cliente c5 = new Cliente(5, "Pedro", "Gomez Hurtado", "09/03/1989",
"53014895-P", "C/Alameda 79", 28624);
private bool tsbGuardarClick = false;
private void valoresArray()
{
listClientes.Add(c1);
listClientes.Add(c2);
listClientes.Add(c3);
listClientes.Add(c4);
listClientes.Add(c5);
}