private void btnEliminar_Click(object sender, EventArgs e) { clsTiCKET tic = tickets.Find(x => x.numeroTicket == int.Parse(txtNumeroTicket.Text)); if (tic != null) { tickets.Remove(tic); dgvRegistroPeajes.DataSource = null; dgvRegistroPeajes.DataSource = tickets; } else { MessageBox.Show("No esta registrado"); } }
private void btnAgregar_Click(object sender, EventArgs e) { clsTiCKET tic = tickets.Find(x => x.numeroTicket == int.Parse(txtNumeroTicket.Text)); if (tic == null) { clsTiCKET t = new clsTiCKET(); t.numeroTicket = int.Parse(txtNumeroTicket.Text); t.fechaTicket = dtpVehiculo.Value; t.tipoVehiculo = cboTipoVehiculo.Text; tickets.Add(t); dgvRegistroPeajes.DataSource = null; dgvRegistroPeajes.DataSource = tickets; } else { MessageBox.Show("Numero exixtente"); } }