Line Count (File Qty) from Listbox Items
-
12-06-2021 - |
문제
Here is the current code I am using to add files and check the number of lines in each file that was selected (file qty). This is also added into a seperate listbox for viewing.
Dim selectedItems = (From i In ListBox2.Items).ToArray()
For Each selectedItem In selectedItems
ListBox1.Items.Add(selectedItem)
ListBox2.Items.Remove(selectedItem)
Dim FileQty = selectedItem.ToString
Dim LineCount = System.IO.File.ReadAllLines(TextBox1_Path.Text + "\" + FileQty).Length
ListBox6.Items.Remove(LineCount)
Next
I'm not sure how to then count all the files that were selected to obtain a grand total.
해결책
If you do a getSelectedItems(), this will give you indexes of selected files. So with a .count on it you will have the number of selected items. Or count the number of times you did the for. This will give you the same answer.
제휴하지 않습니다 StackOverflow