|
Post by Psycho on Oct 9, 2011 11:47:20 GMT -5
I have a program that makes extensive use of subroutines for pulling data from an SQLlite database and displaying as a listbox for user selection. That program is over a year old and working fine. I just coded something similar in a new program I am working on and get the following error:
Runtime Error in program 'untitled': listbox #partList, partList$(), 0 Message not understood: #asCollection
When I put the listbox into the body of the program (where it is remarked out in the follwing demo) it displays fine. When I put it into a sub, I get the error above . Here is a throw together to show the problem I am having: global #partList
'dim array here to make global dim partList$(10)
call loadPartList 'listbox #partList, partList$(), 0 wait
sub loadPartList for x = 1 to 10 partList$(x)=str$(x) next x 'having the listbox here causes an error????? listbox #partList, partList$(), 0 end sub Any ideas? John "Psycho" Siejkowski
|
|
|
Post by Brent on Oct 9, 2011 12:23:28 GMT -5
I seem to remember this is a long-standing bug where objects created inside subroutines cannot access global arrays. As far as I can determine, the only work-around is to move the DIM inside the sub.
|
|
|
Post by Psycho on Oct 9, 2011 12:46:04 GMT -5
Thank you Brent. That bug was indeed causing my problem. The previous program I mentioned was dimming the arrays inside the sub, hence it working correctly.
As always, I appreciate the help.
John "Psycho" Siejkowski
|
|