1
Answer

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

Ask a question
April Zoomm

April Zoomm

14y
2.1k
1
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,

------------BEGIN---------------
private void btn_CreateReport_Click(object sender, EventArgs e)
{

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

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

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

Answers (1)