Solved

Howto AddRange to ListView??

Posted on 2008-10-15
1
1,455 Views
Last Modified: 2013-11-26
Hi,

I am trying to use Listview.AddRange in VB.NET but its expecting an array, unfortunately I don't know how many items will be in the array, so I was going to use an ArrayList... Unfortunately, you can't use this inside the AddRange.

Does anyone have a simple example of building an array and adding it using AddRange?


Thanks!
0
Comment
Question by:nickrawlins
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
wmestrom earned 500 total points
ID: 22724125
Hi,

you can use to ToArray method of a List(Of ListViewItem) instead. Hope that helps.

Greets,
Willem
        Dim listView As New System.Windows.Forms.ListView
        Dim itemList As New List(Of System.Windows.Forms.ListViewItem)
        itemList.Add(New System.Windows.Forms.ListViewItem("Item1"))
        itemList.Add(New System.Windows.Forms.ListViewItem("Item2"))
        listView.Items.AddRange(itemList.ToArray)

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question