Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Using a collection, I am populating a listview. There is a button called "Check Status" and when clicked it calls the CheckBookStatus method. I am wanting to go through each author listed and in my column called "Status" would like update the status to be updated to "Yes" or "No". I have posted the code of what I have so far. Much help is appreciated! Thank you!

My ListView is:

Author Name Book Name Status

C#
#Private Properties
private Book.AllAuthorsCollection allauthorsCollection = null;
private string status = string.Empty;
 

private void CheckBookStatus()
{

long authorkey = this.AuthorKey;
 
Book.Books books = null;
this.status = books.Status;
int count = 0;
this.allauthorsCollection = Book.Books.AuthorIndex(authorkey);
count = this.allauthorsCollection .Count;
for (int i = 0; i < count; i++)
{
 
books = this.allauthorsCollection[i];

// check status
result = Book.Books.CheckAuthors(allauthorsCollection[i].AuthorKey);
 
if (this.status == "1")
{
 
}
else if (this.status == "2")
{
 
}
 
}
 
}
.
Posted
Updated 7-Oct-12 10:17am
v2
Comments
BillWoodruff 7-Oct-12 23:47pm    
Do you understand right now how to go through (iterate across, traverse, etc.) a ListView, and access/change the values in a specific column for each "row" in the ListView ? Or, is that the question ?

If the question is: how do you access your collection, then I think you should show us here the structure of the collection; we can only guess what it is from what you show here.
ahlaj77 8-Oct-12 8:06am    
First statement you said, is the question. Thank you for your reply.
Varun Sareen 9-Oct-12 2:11am    
this link might help you out:-

http://www.codeproject.com/Articles/31640/Basics-of-NET-Collections-in-C
Varun Sareen 9-Oct-12 2:12am    
This link can give clear insight into what you are requiring:-

http://www.codeproject.com/Articles/31640/Basics-of-NET-Collections-in-C

Regards

Varun Sareen

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