listbox/listindex goes bad (suddenly!)

listbox/listindex goes bad (suddenly!)

Post by rbyt » Thu, 20 May 2004 22:51:02


Hello...

I have a multitab userform with many different controls.
has a total of 8 listboxes, 7 on one tab of the form, one
by itself on a different tab. had programmed both click
and double-click events for all 8. except for using
different arrays and referencing different controls, this
part of the double-click event code is identical for all
listboxes:

s = 3
i = theSelectedListBox.ListIndex
selectedItem = myArray(i)

myArray represents the values used to fill the listbox.

Now i have earlier versions of this project that i
retested to make sure i'm not crazy...it WORKED before.
but just noticed yesterday that recently the code for the
standalone box (on its own tab) no longer returns the
listindex value on a double-click event. in effect, every
time dblclick is used it returns a .listindex value of -
1, .value of Null (thus the code is now always having an
error on the 3rd line above because -1 is not a valid
array index).

I have checked and rechecked, even recreated the listbox,
so that there is no question it is IDENTICAL to the other
7 that are still working fine (form tab settings identical
as well). an earlier version of the project, which is ALSO
identical in code and listbox properties, still works. the
Click event for the same listbox DOES give the correct
listindex value, no errors there.

so why might the double-click event for this one
particular list box have stopped producing a valid
ListIndex value all of a sudden? Only thing that has
changed on our systems here is regular Windows updates,
plus other code that has nothing to do with this listbox
has been updated in the project. none of which explains to
me why other 7 listboxes are still working.

any suggestions welcome, as i do believe this will drive
me mad very soon :)

thanks!!!
 
 
 

listbox/listindex goes bad (suddenly!)

Post by Jonathan W » Thu, 20 May 2004 23:29:25

If there is nothing obvious about the change in code that would explain this
behavior, and if you have been editing and updating the template through
many versions, then you might be suffering from a touch of template bloat.
Take a look at this article for a cure.

Combatting Template Bloat
http://www.yqcomputer.com/


--
Regards
Jonathan West - Word MVP
http://www.yqcomputer.com/
Please reply to the newsgroup

 
 
 

listbox/listindex goes bad (suddenly!)

Post by rbyt » Thu, 20 May 2004 23:54:53

thank you jonathan, i had a feeling this might be the
problem. actually cleaned up alot of code recently but
have found that doesn't necessarily clean up the file :) i
will check out the link and keep fingers crossed for a
solution.


would explain this
template through
of template bloat.
message

one
this
the
every
listbox,
other
identical
ALSO
the
to