public void ListarCartao() { _dtCartoes = BusinesCartao.ListarDebito(); MessageBox.Show(_dtCartoes.Rows[0]["taxa_credito"].ToString()); var dt = _dtCartoes.AsEnumerable().Where(x => x.Field <decimal>("taxa_credito") > 0).Select(k => { var row = _dtCartoes.NewRow(); row.ItemArray = new object[] { k.Field <Int32>("id_bandeira"), k.Field <string>("nome_bandeira"), k.Field <decimal>("taxa_debito"), k.Field <decimal>("taxa_credito") }; return(row); }); if (dt.Any()) { dgvCredito.DataSource = dt.CopyToDataTable(); dgvCredito.Columns["id_bandeira"].Visible = false; dgvCredito.Columns["taxa_credito"].Visible = false; dgvCredito.Columns["taxa_debito"].Visible = false; } else { MessageBox.Show("nada aqui"); } }
private void FormCartoes_Load(object sender, EventArgs e) { dgvCadastros.DataSource = BusinesCartao.ListarDebito(); dgvCadastros.Columns["id_bandeira"].Visible = false; DataGridViewButtonColumn btnExcluir = new DataGridViewButtonColumn(); btnExcluir.HeaderText = "Excluir"; btnExcluir.Text = "X"; btnExcluir.UseColumnTextForButtonValue = true; dgvCadastros.Columns.Add(btnExcluir); }