I have added a ListView to my form.

I have a class Called Contact with name, lastname and phone nr.
How do I add all this to my listview?
All my contacts is in a List<Contact>

And....finally is it possible to add a dropdownlist in a listview? For example if my phone nr will be added in alist so you can have more than one phone nr?
Who is Participating?
angus_young_acdcConnect With a Mentor Commented:
The follow snippet will add each of your contacts from the list to your ListView.  As for a dropdownlist, you would need to google for a custom listview control.
foreach (Contact contact in contacts)
                ListViewItem subItem = listView1.Items.Add(contact.Name);

Open in new window

Oh should add to that, be sure have created the columns in your list view.
MickeysAuthor Commented:
Right now they appear after each other like this

Mike Andersson        Peter Carlsson   .......

I want them to be each on one row like:
Mike Andersson
Peter Carlsson

and do I add column name?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.