I have a question about list box too if i may.. I have a listbox with entries in it like the following; 5 0 3 2 9 6. The spaces are tabs on the same line. That is just one line, I will have 31 lines meaning 31 days wich represent the first entry, the 5 in this case, the rest of the numbers are dif items sold for that day. How can i sum up the total of the colums on a button click event? Any help will be appreciated..
As far as I know, all the listbox has is an array of strings (rows), not columns. So to sum a column you would need to loop through the entries, split them (use the Split() function) and add the resulting details. For example, to pick out the third "column" (skipping the count at the start) from the fifth "row" I believe the expression would be somethiing like
Split(lstNum(4), vbTab)(3).
That is, take the value of
lstNum(4), then use
Split() to pull it apart at the tabs, creating an array. Use element 3 from the array. VB just says it in a more compact form. :)
Note, I'm pretty sure that they both start at zero but I've allowed for the "count column".