Article ID: 194912 - Last Review: March 7, 2005 - Revision: 2.1 FIX: Add Method of Forms Collection Fails in ExecutableThis article was previously published under Q194912 On This PageSYMPTOMS
You are using the Add method of the Forms collection to load a form. The
code works correctly in the Visual Basic development environment, but fails
with the following error when the application is made into an executable:
Run-time error '-2147417848 (80010108)':
Automation error. RESOLUTION
You can work around this problem by creating your own Forms collection. A
reference to the form can be added to a collection, and keyed by the Form's
name. This will let you load a form by specifying a text string and
referencing the matching key field in the collection.
There are two options with this approach. You can pre-load the collection with a reference to all of the forms in the application at startup, which is the approach used in the following example. You may also load the forms into the collection as needed. There is slightly more programmatic overhead with the second approach, because you must check to see if the form is already in the collection. It is also important to note that adding the forms to the collection does not load the forms. Steps to work around this problem are:
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base: 194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why (http://support.microsoft.com/kb/194022/EN-US/ ) 194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed (http://support.microsoft.com/kb/194295/EN-US/ ) MORE INFORMATIONSteps to Reproduce Behavior
APPLIES TO
| Article Translations
|
Back to the top
