Total members 9952 | Gratitudes |It is currently Sat Feb 11, 2012 1:46 pm Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 2 posts ] 
Author Question
 Question subject: How can i display these items in Listview in C#?
PostPosted: Wed Apr 07, 2010 6:12 pm 
Offline
Newbie
User avatar

Joined: Wed Apr 07, 2010 6:07 pm
Posts: 1
Has thanked: 0 time
Have thanks: 0 time

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 ?

Cheers,
Code:
------------BEGIN---------------
private 
void btn_CreateReport_Click(object senderEventArgs e)
{

lstview.Items.Clear();
int counterOfArraylist mcarraylist.Count;
string[] str = new string[counterOfArraylist];
for (
int i 0str.Lengthi++)
{

str[i] = mcarraylist[i].ToString();

}
lstview.Items.Add(new ListViewItem(str)); 
}
------------
END--------------- 


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: How can i display these items in Listview in C#?
PostPosted: Sun May 23, 2010 7:02 pm 
Offline
Newbie
User avatar

Joined: Sat Jan 17, 2009 7:51 pm
Posts: 13
Has thanked: 0 time
Have thanks: 1 time
hi,
I hope this code help you.



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace listview
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{

string[] str=new string[71];
for (int i = 0; i <= 70; i++)
{
str[i] = String.Format("{0}",i);//Please Insert your data in array//

}
for (int j = 0; j < str.Length; j++)
{
listView1.Items.Add(str[j]);
}
}
}
}


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 2 posts ] 
Quick reply


  


 Similar topics
 Topic title   Forum   Author   Comments 
 Need to Display Content using JavaScript in HTML page  Scripting Language  stankov  0
 database contents display in table format in swing  GUI  subho07  4
 not taking items using jquery  Scripting Language  ravi951  0
 read php file in asp and display it as html  ASP/ASP.net examples  msi_333  0
 display the content of text file  ASP/ASP.net examples  msi_333  0

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team