Igor Igor - 1 month ago 7
C# Question

How add ArrayList to listview1 in c#

I have an ArrayList

...
while (reader.Read())
{
decimal nr_zbor = reader.GetDecimal(cod_zbor);
string airport = reader.GetString(name_aeroport);
string company = reader.GetString(name_company);
list.Add(nr_zbor);
list.Add(airport);
list.Add(company);
}
...


and I wish to put in the listview columns[zbor,airport,company], but I don't now how

fly = searchFly.GetFly(direction, country, theDate, DFlexible);


can you help me?

Answer

One option is to create a class with those 3 properties

class nac
{
   public decimal nr_zbor ...
   public string airport ...
   public string company ...
}

List<nac> nacs = new List<nac>();

Those properties are the columns

ListView Class

Comments