Click here to Skip to main content
12,360,321 members (58,988 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
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

#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 7-Oct-12 10:12am
ahlaj77146
Updated 7-Oct-12 10:17am
ridoy57.9K
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 7 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100