private void btnAgregar_Click(object sender, EventArgs e) { bool asd = int.TryParse(txbCantidad.Text, out int cantidad); Producto auxProducto = (Producto)dgvProductos.CurrentRow.DataBoundItem; if (!Comercio.AgregarArticuloAlCarrito(new ArticuloCompra(cantidad, auxProducto, (auxProducto.PrecioUnitario * cantidad), auxProducto.PrecioUnitario))) { MessageBox.Show($"La cantidad de {auxProducto.Descripcion} solicitada excede el stock disponible!"); } else { this.dgvCarrito.DataSource = null; this.dgvCarrito.DataSource = Comercio.CompraEnCurso.Productos; this.txbPrecioFinal.Text = $"${Comercio.CompraEnCurso.PrecioTotal.ToString()}"; } }