private void btnIngresar_Click(object sender, RoutedEventArgs e) { bool textBoxVacios = false; if (txtnombreIngresar.Text == "" || txtprecioCompra.Text == "" || txtcantidad.Text == "" || txtprecioVenta.Text == "") { textBoxVacios = true; } if (textBoxVacios == false) { string nombreProducto = txtnombreIngresar.Text; int precioCompra = Convert.ToInt32(txtprecioCompra.Text); int precioVenta = Convert.ToInt32(txtprecioVenta.Text); int cantidad = Convert.ToInt32(txtcantidad.Text); var miProducto = new tblproducto(); miProducto.producto = nombreProducto; miProducto.precioCompra = precioCompra; miProducto.precioVenta = precioVenta; miProducto.cantidad = cantidad; miProducto.Agregar(miProducto); txtnombreIngresar.Text = ""; txtprecioCompra.Text = ""; txtprecioVenta.Text = ""; txtcantidad.Text = ""; } }