2
I own a ListView listViewListaChamada
and I am trying to add columns and values to the columns corresponding to my ListView listViewListaChamada
, however I did not succeed. I created the function below to popular my Listview:
private void PopulaListView(MListaPresenca lista_chamada, ListView listview, MAluno aluno)
{
listview.Items[0].SubItems.Add(aluno.Nome);
listview.Items[1].SubItems.Add(lista_chamada.Presente);
}
Where the first column receives the nome
of the student and the second column receives the value of the attribute Presente
the value of which may be SIM
or NÃO
, so mine ListView
will be left with two columns, however, when entering the values I receive the following error:
"Invalidargument=Value '0' is not a valid index value. r nName of the parameter: index"
I would like to know how to add columns and values in my columns ListView
at runtime?