Control Removed From Collection-VBForums
Results 1 to 4 of 4

Thread: Control Removed From Collection

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2011
    Posts
    31

    Control Removed From Collection

    Hi everyone,

    The development team in my company meets a stange bug for few days while executing a VB6 project.
    My program is linked to a PostgreSQL database via an ODBC connection.
    Here is the procedure I follow to reproduce the bug :

    1. I open a form. The form is identified with the code FRM-1 in this procedure.
      Here are some features of FRM-1 :
      • It contains a tabbed control.
      • It contains collections of controls.
        The collections lblEtiquette and cmdListe are ones of them.
        The controls of these two collections are not all located on the same tab.
        We created collections of controls in most of forms in our VB6 project to limit the number of identifiers.

    2. I close FRM-1.
    3. I open FRM-1 again but now the controls indexed at 9 in the lblEtiquette and cmdListe collections are missing [BUG].


    We consider the fact at step 3 as a bug because of the following reasons :
    • The program never adds or removes controls in collections during its execution.
    • The procedure does not raise the bug everytime.


    I do not expect a miracle solution to this bug.
    I suspect this bug to come either from the PostgreSQL driver or from the VB6 limit of identifiers.
    Does anyone have ever experimented this kind of bug ?

    We reached the VB6 limit of identifiers few months ago.
    We renamed some entities within the project but now we can only add 11 new identifiers.
    That is why I suspect the limit of identifiers as a possible cause for the bug.

    Thanks in advance for your future help and advices

  2. #2
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: Control Removed From Collection

    I have no idea what you mean by identifier. What VB6 limit of "identifers" have you met?
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  3. #3
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,135

    Re: Control Removed From Collection

    It appears that you have Control Array rather than Collection (although form object exposes controls collection via property).

    How does each control array get loaded?
    Was lblEtiquette(9) created at design or runtime?
    Do you assign Container to each control if created at runtime?
    Check Tab_Click event (or whatever applies) to see what's going on when user changes tabs.
    I would search (within the code) for Load and/or Unload to see how controls are loaded/unloaded.

    etc... but please answer those queues first.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jan 2011
    Posts
    31

    Re: Control Removed From Collection

    For Hack :

    I have no idea what you mean by identifier. What VB6 limit of "identifers" have you met?
    Project Limitations

    A single project can contain up to 32,000 "identifiers" (any nonreserved keyword), which include, but are not limited to, forms, controls, modules, variables, constants, procedures, functions, and objects. Note that the actual number of identifiers is limited to available memory.
    For RhinoBull :

    How does each control array get loaded?
    Each control array has been created at design time so they get loaded when the container form gets loaded.

    Was lblEtiquette(9) created at design or runtime?
    lblEtiquette(9) was created at design time. The program corresponding to the VB6 project never adds or removes controls at runtime. But sometimes it makes controls visible or not.

    Check Tab_Click event (or whatever applies) to see what's going on when user changes tabs.
    I would search (within the code) for Load and/or Unload to see how controls are loaded/unloaded.
    I tried to debug within event routines but each time the bug does not raise.
    I do not think that event debugging is reliable in VB6.

    Then I wrote "Debug.Print" statements inside some event routines such as : Form_Load, Form_Unload, event routines offered by the tabbed control, ...
    The "Debug.Print" statements depended on the following test :
    Code:
    If (lblEtiquette(9) Is Nothing) Then
    Unfortunately the bug does not raise again.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.