Example #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            Productos cli = new Productos();

            cli.ShowDialog();

            if (cli.DialogResult == DialogResult.OK)
            {
                try
                {
                    if (cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[4].Value.ToString() == "0")
                    {
                        MessageBox.Show("Lo Siento Producto Agotado", "¡Atencion!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else if (cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[0].Value.ToString() == "0")
                    {
                        MessageBox.Show("Lo Siento Producto Vencido", "¡Atencion!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        txtcodigofac.Text = cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[2].Value.ToString();
                        txtdes.Text       = cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[3].Value.ToString();
                        txtpre.Text       = cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[6].Value.ToString();
                        lblcant.Text      = cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[4].Value.ToString();
                    }
                }
                catch (Exception lppp)
                {
                    MessageBox.Show("Algo Va Mal..." + lppp);
                }
            }

            txtcanti.Focus();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                Productos cli = new Productos();


                cli.ShowDialog();

                if (cli.DialogResult == DialogResult.OK)
                {
                    txtid.Text         = cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[1].Value.ToString();
                    txtcodigo.Text     = cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[2].Value.ToString();
                    txtdescripc.Text   = cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[3].Value.ToString();
                    txtexistencia.Text = cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[4].Value.ToString();
                    txtcatiui.Text     = cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[5].Value.ToString();
                    combouni.Text      = cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[6].Value.ToString();
                    txtbodega.Text     = cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[7].Value.ToString();
                    txtlote.Text       = cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[8].Value.ToString();
                    txtprecon.Text     = cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[9].Value.ToString();
                    date12.Text        = cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[10].Value.ToString();
                    txtmarca.Text      = cli.dgv.Rows[cli.dgv.CurrentRow.Index].Cells[11].Value.ToString();
                }
            }
            catch (Exception em)
            {
                MessageBox.Show("" + em.Message);
            }
        }