コード例 #1
0
        private void dgGride_CellDoubleClick_1(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex >= 0)
            {
                if (e.RowIndex >= 0)
                {
                    codigo = Convert.ToInt32(dgGride.Rows[e.RowIndex].Cells[0].Value);
                }
            }
            ComandosProdutos comando = new ComandosProdutos();
            DadosProdutos    dados   = comando.Carregar(codigo);

            txbCodigo.Text     = dados.Codigo.ToString();
            txbNome.Text       = dados.Nome;
            txbDescricao.Text  = dados.Descricao;
            txbQuantidade.Text = dados.Quantidade.ToString();
            txbValor.Text      = dados.Valor.ToString("N2");
            salvarEditar       = "Alterar";
            AlterarBotoes(1);
        }
コード例 #2
0
        private void dgGride_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex >= 0)
            {
                if (e.RowIndex >= 0)
                {
                    codigo = Convert.ToInt32(dgGride.Rows[e.RowIndex].Cells[0].Value);
                }
            }
            ComandosProdutos comando = new ComandosProdutos();
            DadosProdutos    dados   = comando.Carregar(codigo);

            txbDescricaoProduto.Text = dados.Nome.ToString();
            lblValorUnitario.Text    = dados.Valor.ToString();
            lblCodigoProduto.Text    = dados.Codigo.ToString();
            lblValorTotal.Text       = lblValorUnitario.Text;
            if (lblQuantidade.Text != "")
            {
                double resultado = Convert.ToDouble(lblQuantidade.Text) * Convert.ToDouble(lblValorUnitario.Text);
                lblValorTotal.Text = Convert.ToString(resultado);
            }
        }