I am encountering a bizarre (at least to me) problem using a Collection, which I’ll call gcollFoo, when working within an MDI/child environment in VB6. <br>
<br>
I declare and create gcollFoo as a global object in the Code Module. <br>
<br>
When gcollFoo is populated (with a series of string variables, each without a key) within the MDI Main window, problems arise when I attempt to access it in child window ‘A’. When I try to read any one of gcollFoo’s members, eg with the statement strMem = gcollFoo(integer), VB6 crashes with the error message 'either BOF or EOF is true or the current record has been deleted; the operation requires a current record.’ Yet, gcollFoo is intact prior to the crash, as demonstrated by the fact that its .Count Property and .Remove Method work properly!<br>
<br>
Furthermore, when gcollFoo is populated in child window ‘B’ (ie and not in MDI Main) then the very same code in child window ‘A’ can loop through and read its members without a hitch!!<br>
<br>
I have tried late binding, ie declaring gcollFoo in the Code Module and creating it in MDI Main, but this does not help. Also, adding a key to each member gets me nowhere.<br>
<br>
I would also note that in a much simpler MDI test program I wrote, where I do (it would seem) the exactly analogous operations, I encounter no problems, thus demonstrating that it is legal to fill a global Collection in MDI main and read it in a child window. <br>
<br>
Any thoughts on the matter are greatly appreciated!<br>
<br>
TIA<br>
<br>
/Frank<br>
<br>
<br>
I declare and create gcollFoo as a global object in the Code Module. <br>
<br>
When gcollFoo is populated (with a series of string variables, each without a key) within the MDI Main window, problems arise when I attempt to access it in child window ‘A’. When I try to read any one of gcollFoo’s members, eg with the statement strMem = gcollFoo(integer), VB6 crashes with the error message 'either BOF or EOF is true or the current record has been deleted; the operation requires a current record.’ Yet, gcollFoo is intact prior to the crash, as demonstrated by the fact that its .Count Property and .Remove Method work properly!<br>
<br>
Furthermore, when gcollFoo is populated in child window ‘B’ (ie and not in MDI Main) then the very same code in child window ‘A’ can loop through and read its members without a hitch!!<br>
<br>
I have tried late binding, ie declaring gcollFoo in the Code Module and creating it in MDI Main, but this does not help. Also, adding a key to each member gets me nowhere.<br>
<br>
I would also note that in a much simpler MDI test program I wrote, where I do (it would seem) the exactly analogous operations, I encounter no problems, thus demonstrating that it is legal to fill a global Collection in MDI main and read it in a child window. <br>
<br>
Any thoughts on the matter are greatly appreciated!<br>
<br>
TIA<br>
<br>
/Frank<br>
<br>