Click here to Skip to main content
15,918,303 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
i have a listview in my windows form and i want to load each row of my listview to data table,
please help me
regards
bunzitop
Posted
Comments
[no name] 16-Mar-13 9:13am    
Please show what have you tried ?
bunzitop 16-Mar-13 9:27am    
DataTable dt = new DataTable();

foreach (ListViewItem item in listView1.Items)

{

table.Columns.Add(item.ToString()); //For adding column namescol

foreach (var it in item.SubItems) //For adding row values

dt.Rows.Add(it.ToString());

}
[no name] 16-Mar-13 9:20am    
Help with what? You did not ask a question or describe any kind of a problem.
bunzitop 16-Mar-13 9:27am    
i have already stated with my problem,
i have a listview and my requirement is to load the listview items to datatable
hope you have understood my problem
[no name] 16-Mar-13 9:35am    
No... as a matter of fact, you did not state any kind of a problem. If your requirement is to load items to a datatable, then do it. What exactly is the problem? We cannot read your mind. You have to tell us what the problem you are having is. Where is the code that demonstrates your problem? Do you get any errors when you run your code?

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