Word documents are loaded dataGridView .

How to display in the textBox field the number of loaded documents? In order to know, in which case, which documents were uploaded and which were not.

  • 2
    To ask the dataGridView how many documents are loaded into the program is bad. You may ask how many lines he has, but not documents. It is better to keep a collection of documents separately in the program, and work with it. And use dataGridView only to display information to the user. - RusArt
  • Well, I have the number of lines. It just happens that the documents are not all loaded, but they will think that everything will start, then the confusion will begin. And where to look for those that did not boot? Damn, I myself don’t know how to do it or not at all. Or, for example, if some document does not load, then the error fell out .. - Jan
  • @RuslanArtamonov if a line in the grid denotes a document, then the number can be obtained through the number of lines. and if in fact it is not enough information: for example, the class describing the document. where / how to find out if there is a downloaded document or not - Bald
  • 2
    @ Yana Make a wrapper class document. Let him have a field - document Word. Let him have a flag - loaded yes / no. Let him have a load method, which at the end sets the flag to yes. If an error occurs, you will know that this document is not loaded. Let the program have a list of these wrapper classes. When you create a new - add to this sheet. And only at the end of the addition already update your dataGridView. - RusArt

1 answer 1

I would probably do something like this:

created a class Document :

 public class Document { public int Id {get; set;} public string Path {get;set;} public bool HasAttachedFile {get;set;} } 

when attaching / uploading a file, if successful, set the corresponding flag ( HasAttachedFile ) to true

 public IEnumerable<Document> GetDocuments() { //метод который будет возвращать список документов } 

There must be a field in the grid indicating whether the file is uploaded or not.

there should also be a method that will show the number of documents without the file loaded

 public int GetCountDocumentsWithoutAttachment() {}