コード例 #1
0
        private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            string numF = (string)dataGridView2.CurrentRow.Cells["num_factp"].Value;

            btnModificar2.Enabled = true;
            btnNuevo2.Enabled     = true;
            btnGuardar2.Enabled   = false;

            txtCodCheque.Enabled  = false;
            txtNumCuenta.Enabled  = false;
            txtBanco.Enabled      = false;
            txtMontoPagar.Enabled = false;
            datePago.Enabled      = false;
            cbNumFactP.Enabled    = false;



            pictureCodigo.Image    = null;
            pictureNumF.Image      = null;
            pictureNroCuenta.Image = null;
            pictureFechaP.Image    = null;
            pictureMonto.Image     = null;
            pictureBanco.Image     = null;

            using (SqlConnection conexion = Conexion.obtenerConexion())
            {
                SqlCommand    comando = new SqlCommand(string.Format("Select * from pagoFacturasCompra where num_factp like '%{0}'", numF), conexion);
                SqlDataReader reader  = comando.ExecuteReader();
                while (reader.Read())
                {
                    txtCodCheque.Text = reader.GetString(0);
                    string p = MetodosBD.buscarNumFactP(reader.GetString(1));
                    cbNumFactP.SelectedIndex = cbNumFactP.FindString(p);
                    datePago.Value           = Convert.ToDateTime(reader.GetString(2));
                    txtNumCuenta.Text        = Convert.ToString(reader.GetInt32(3));
                    txtMontoPagar.Text       = Convert.ToString(reader.GetDecimal(4));



                    txtBanco.Text = reader.GetString(5);
                }
                conexion.Close();
            }
        }