public ClaseBase buscarPorCodigo(int cod) { ClaseBase temp = inicio; while (temp != null) { if (temp.Codigo == cod) { return(temp); } temp = temp.Siguiente; } return(null); }
private void btnAgregar_Click(object sender, EventArgs e) { try { ClaseBase nuevo = new ClaseBase(txtProducto.Text, txtAlumno.Text, txtVehiculo.Text, Convert.ToInt32(txtContacto.Text), Convert.ToInt32(txtCodigo.Text)); cat.agregarObjeto(nuevo); txtAlumno.Clear(); txtContacto.Clear(); txtProducto.Clear(); txtVehiculo.Clear(); txtCodigo.Clear(); } catch (FormatException) { DialogResult r = MessageBox.Show("Llena todos los campos", "Importante", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void eliminarPrimero() { inicio = inicio.Siguiente; inicio.Anterior = null; }