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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie using Check boxes

Status
Not open for further replies.

orisons

Programmer
Feb 18, 2002
49
CA
Hi all
I'm back with more silly Questions, this time I would like to know how I can use check boxes to load up lists now I know the "additem" and I have used it quite successfully to update a list but when I update the list I also need figures to go with the test. i.e. text "9 inch dc 45lbs/foot" then variable would be 45, this list can be added to in any order (from a choice of 20 items (using checkboxes))so I seem to get it all confused when items are removed from the list and others put in.
Please any help would be appriciated>
 
Okedokie...

This ain't neat, and it ain't pretty, but it will probably work...

Whenever the value on a checkbox changes (either through code or your actually clicking the varmit), a click event get's fired... That's just the way it is.

So, you in the code for the click event on your checkbox, you should be able to work out what just happened by inspecting the value property of the checkbox. If it's 1, you justed added this item to the list, if not, you removed it. That should help deal with the confusion...

In terms of general advice, you might want to learn about control arrays - as they basically give you the ability to handle a load of checkboxes without having to write event code for each individual box...

And as for removing adding and removing items from the textbox, you might think of either:

1/ Completely emptying the list and repopulating it on each checkbox click.
2/ If you use the control array approach, stick the index of the checkbox into itemdata for the corresponding item on the list. That way, when you come to remove an item, all you have to do is loop down the list until you encounter an element with the itemdata value you're looking for.

I hope that helped.

mmilan
 
thanks I had done the repopulate(but I had a cmd the user had to use to update(but I suppose I could call that on a click event for the chk box)
I also tried arrys but I dont think i fully understand the proper use of them yet,
thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top