473,385 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to sum a 'column' in a listbox holding tab-delimited text

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..
May 21 '07 #1
2 2893
Killer42
8,435 Expert 8TB
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".
May 21 '07 #2
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".

Yes an array is writing to listbox and txt file from txtboxes. I will try it out and see what i come up with. Will let you know. Thanks.
May 22 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jørgen Hansen | last post by:
Hi I have a problem with a Listbox in Tkinter. When I tab through several widgets with the tab-key, the listbox looses its selection, even though it has been selected with .selection_set. The...
4
by: Giulio | last post by:
Hello, I have a continuous form with a combo box inside. From the combo box I can pick some values which, by the "after-update" event, change some other combo box values determined by a query....
7
by: Colleyville Alan | last post by:
I have an app in which users are displayed a list of mutual fund from which they can choose. There is a listbox embedded in a two-tabbed notebook control. When the form is initally opened, the...
2
by: Matt Sawyer | last post by:
Hi, I'm attempting to do a drag and drop operation from one listbox to another. I have my listboxes setup with SelectionMode = MultiExtended so that I can use the shift key, cntrl key, etc. to...
2
by: Alien2_51 | last post by:
I have a ListBox control with the SelectionMode set to MultiExtended bound to an IList collection. The ListBox control is on a tab control, if I have multiple items selected in the list box when I...
5
by: Alien2_51 | last post by:
I have a problem with a ListBox control that is on a TabControl, it seems to be forgetting which items are selected in the list when I tab off the current tab, here's my winform code... I even...
3
by: chreo | last post by:
Hello. I have datagrid. I found code to select all row in data grid (by mouse or arrow keys). This works great - user can select row and... ....and I want to go to next control. For...
3
by: Randy Harris | last post by:
With a multiple column listbox, I'd like to be able to change the sort by allowing the user to click on a column. Is there a practical way detect in which column the user clicked? I know this...
0
by: raypjr | last post by:
Hi everyone. I'm new here and hope I can get a little advice on how to list my array into a ListBox. I have my structure and array of structures. I need help with a For Loop that will list the...
2
by: raypjr | last post by:
Hi everyone. I'm new here and hope I can get a little advice on how to list my array into a ListBox. I have my structure and array of structures. I need help with a For Loop that will list the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.