VB6 sp5 Picture box control vanishes from screen, other usercontrols turn into Pictureboxes

Posted on 2005-05-04
Last Modified: 2010-05-02
More often then I would care to see, my rather large VB project behaves in a most annoying manner.

1.I use a picturebox as a container for user controls (to achieve similar to wizard or guide effect).  Occassionally if I compile but don't save first, the picture box disapears, but the child user controls remain.

2.Sometimes usercontrols become Picturebox (particularly after VB crashes (which it does a lot))

3.Occassionally, OCX controls get references as if they are dlls (or for the OCA file) including standard Microsoft Controls.

Any ideas?
Question by:Zonman
    LVL 22

    Accepted Solution

    Whenever VB loses reference to an undefined control type (like a usercontrol) it will often revert it into a picturebox.

    Usually this occurs when the ctx file is corrupt or missing.

    Unfortunately, VB6 seems to have a lot of problems with large project.  You may want to consider trying to break the project up into multiple projects if possible, or at least for initial development, then reintegrate things after various modules are completed.
    LVL 7

    Expert Comment


    Author Comment

    I have not tried SP6 as the list of bugs fixed did not include anything I could see as necessarily to solved any problems for me.  I will try on the assumption that they haven't told us the full story.

    The comment that VB loses references to undefined controls; we already have broken program down into a logical set of OCX's and dll so to break it down further would be impossible at this stage.

    The question really has to be HOW does the ctx file become corrupt or missing.  The majority of times this problem occurs straight after a compile, particularly when you remember to do a SAVE after the compile.... Why would you not automate saving before compile (as VB does before running in the IDE).
    LVL 22

    Expert Comment

    Again, I think the problem is the complexity of VB in trying to assemble large blocks of memory.  This is a bug that I've seen but haven't been able to isolate.

    Maybe you could add the controls at run-time, even though this is a major pain.
    LVL 22

    Expert Comment

    Points to rspahitz for identifying that VB has internal compile bugs that sometimes corrupt the vbx or ctx files when the project is too large.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now