Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with Listbox's. PLEASE HELP!

Status
Not open for further replies.

nicklad

Programmer
May 19, 2002
29
AU
Hi
i have 3 questions on listboxs. if anyone could give me answers with code (As im quite a novice!) i'd be SOOOO thankful.

1. how do i link 4 listboxs together, so when i select one item on one list, the corresponding index numbers on the other lists are also selected?
2. how do i create a vertical scroll bar that controls more then 1 listbox (in this case 4)?
3.i have 2 listboxs, one of which, lets call it List1, the user inputs an amount in minutes and seconds (e.g. 5.42). I want List2, the other listbox, to show a cumulative total (in mins and secs) or the "Total Running Time" (all the times in List1 addedd together). Is this possible to do with a listbox? or would i be better off with a label/textbox? im not quite sure.

Thank u for ur help!
im in desperate and urgent need of it
[sunshine]
 
the first two are easy in the change event of the the lists you set the listindex of the the remaining item to equal the first

on the scrollbar make the max property = to the list listcount -1 and min value 0
on the change event of the vscroll1 set the listindex of any of the listboxes to the value of the scroll bar

I'm a little unsure of what you are trying to achieve with the third question but it doesn't sound like a listbox kind of application
 
If you always want your list boxes to be on the same index why don't you use a grid control like the MSFlexGrid? It sounds like all the information in the list boxes has a one to one relationship with each other. One control is usually easier than trying to coordinate multiple controls.

For the Scroll bar, you can also link the list boxes vertical scroll bars as you would thier listindexes.

For the third item, you mentioned that a value is inputed by the user. You can't input into a list box. You will need a combo box or text box. If you ment that the user will select times from the list box then that's OK.

It sounds like you want to accumulate multiple selected values from one list box and display the accumulated value.
If you want to select multiple values make sure that the multiselect property is set to true. Each time an item is selected then do your math and display in a text box or label. Try using the click event.

Good Luck

zemp TIA,
zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top