Пример #1
0
        private void btnCagar_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtCant.Text[0] == ',')
                {
                    txtCant.Text = "0" + txtCant.Text;
                }
                if (txtCant.Text == ",")
                {
                    txtCant.Text = "0";
                }
                if (txtCant.Text == "")
                {
                    MessageBox.Show("Por favor inserte un numero valido.");
                }
                else
                {
                    StockManager stock = new StockManager();
                    txtCant.Text.Replace(',', '.');
                    BindingList <Ingrediente> lista = stock.Cargarstocks(int.Parse(cmbIngrediente.SelectedValue.ToString()), float.Parse(txtCant.Text));
                    lista = stock.ListarStock(txtsearch.Text);

                    dgvstock.DataSource = lista;
                    dgvstock.Refresh();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }