Click here to Skip to main content
Rate this: bad
good
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
Edited 7-Oct-12 10:17am
51.3K
v2
Comments
BillWoodruff at 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 at 8-Oct-12 8:06am
   
First statement you said, is the question. Thank you for your reply.
Varun Sareen at 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 at 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
0 OriginalGriff 324
1 Maciej Los 224
2 Sergey Alexandrovich Kryukov 182
3 Richard MacCutchan 120
4 CPallini 120
0 OriginalGriff 5,474
1 Sergey Alexandrovich Kryukov 4,713
2 Peter Leow 2,944
3 DamithSL 2,465
4 Maciej Los 2,434


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