Why does not my DataGrid add anything? [closed]

1
public partial class TelaQuadroAdm : Form
{
    public TelaQuadroAdm()
    {           
        InitializeComponent();           
    } 

    private void TelaQuadroAdm_Load(object sender, EventArgs e)
    {
        Quadro q = new Quadro();
        List<Pais> l = new List<Pais>();
        l = q.obterQuadro();
            foreach (var pais in l)
            {
                object[] row = {
                    pais.posicao,
                    pais.sigla,
                    pais.nome,
                    pais.ouro,
                    pais.prata,
                    pais.bronze,
                    pais.total,                
                };

                dataGridQuadroAdm.Rows.Add(row);
            }
    }

    void BtnMaisClick(object sender, EventArgs e)
    {

        Hide();
        TelaAdicionarPais tela = new TelaAdicionarPais(dataGridQuadroAdm);

        tela.ShowDialog();
    }

    void BtnMenosClick(object sender, EventArgs e)
    {
        int linha = dataGridQuadroAdm.CurrentCell.RowIndex;

        string sigla = (string)dataGridQuadroAdm.Rows[linha].Cells[1].Value;    
        Quadro q = new Quadro();
        Hide();
        q.remover(sigla);
        TelaQuadroAdm tela = new TelaQuadroAdm();
        tela.ShowDialog();          
    }

    void BtnAlterarPaisClick(object sender, EventArgs e)
    {
        int linha = dataGridQuadroAdm.CurrentCell.RowIndex;

        string sigla = (string)dataGridQuadroAdm.Rows[linha].Cells[1].Value;
        Hide();
        TelaAlterarPais tela = new TelaAlterarPais(sigla);

        tela.ShowDialog();
    }

    void BtnGerenciarUsuarioClick(object sender, EventArgs e)
    {
        Hide();
        TelaGerenciarUsuario tela = new TelaGerenciarUsuario();

        tela.ShowDialog();
    }

    void BtnLogoutClick(object sender, EventArgs e)
    {
        Hide();
        TelaQuadroVisitante tela = new TelaQuadroVisitante();

        tela.ShowDialog();
    }

    void DataGridQuadroAdmCellContentClick(object sender, DataGridViewCellEventArgs e)
    {

    }
}
    
asked by anonymous 23.09.2016 / 04:57

1 answer

2

Apparently with the error, it seems that InitializeComponent(); is missing inside the constructor of form public TelaQuadroAdm()

public TelaQuadroAdm()
{
   InitializeComponent();
}
    
23.09.2016 / 13:55