2 Replies - 4623 Views - Last Post: 09 April 2010 - 04:07 PM Rate Topic: -----

#1 Guest_New April*


Reputation:

How can i display these items in Listview in C#?

Posted 08 April 2010 - 11:21 AM

Hi all,

I have an ArrayList that contains 70 items. I would like to display these items in Listview. Therefore, I used the following code.
However, When I press the button, program will only display the first seven items in the arrayList. The rest of items are not being displayed in listview.
How can I fix this problem ?


Attached Image

Is This A Good Question/Topic? 0

Replies To: How can i display these items in Listview in C#?

#2 DuoShin85  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 39
  • View blog
  • Posts: 135
  • Joined: 18-December 09

Re: How can i display these items in Listview in C#?

Posted 08 April 2010 - 12:44 PM

I'm assuming your ArrayList is full of string values. If so, you can drop the string array bit you have there and use a foreach instead.

foreach(string arrayListItem in arrayList)
{
   listView.Items.Add(new ListViewItem(arrayListItem));
}


This post has been edited by DuoShin85: 08 April 2010 - 12:52 PM

Was This Post Helpful? 0
  • +
  • -

#3 MentalFloss  Icon User is offline

  • "ADDICTED"[2:5]
  • member icon

Reputation: 526
  • View blog
  • Posts: 1,397
  • Joined: 02-September 09

Re: How can i display these items in Listview in C#?

Posted 09 April 2010 - 04:07 PM

Now, this is the technique you want but I haven't done it myself nor have I really read through it.
This is laziness and negligence on my part so feel free to down-vote my post if it makes you happy.

Anyway, the technique you probably want is data binding. So here's that link: http://www.codeproje...ataBinding.aspx

Again - disclaimed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1