Click here to Skip to main content
16,004,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Good Morning
Could anyone help me
How to bind a column of listview in winform C#. i have an array of int i want to display array values in a column.
And serial number in other column
like
S.no. Values
1 25
2 30
3 60

values column want to bind with array and s.no to a count variable i have.
Posted
Updated 10-Feb-14 18:20pm
v2
Comments
Prasad Avunoori 11-Feb-14 1:04am    
You have to convert this array to Dictionar<key,value> then bind to ListView.
bunty swapnil 11-Feb-14 2:01am    
Hi Prasad ,
i am working on windows form not on wpf.
Krunal Rohit 11-Feb-14 2:50am    
Dictionary is a Generic. Give it a try.!
Prasad Avunoori 11-Feb-14 4:10am    
Bunty,

Dictionary<,> not only specific to WPF it's a C# concept.

1 solution

C#
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));
}
------
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900