Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Does anyone know what the error message in the subject line is trying to tell me? I was making small tweaks to a form that I had copied over from VB6 to VB.NET. It had been doing great, but now when I click on the Design View I get this message:

 

An error occurred while loading the document. Fix the error, and then try loading the document again. The error message follows:

Exception from HRESULT: 0x80047E2C

 

I have no idea! Not much was changed between the two versions, and I believe I commented out everything that was new.

Posted

Okay, I found this in the Help File, but doesn't help me figure out how to fix my form:

 

 

What is HRESULT: 0x80047E2C?

This error can occur when you manipulate the CodeModel objects of Visual Basic source files.

When you are writing code that maintains references to CodeElement objects, you should be aware that the underlying source code can change while you are holding the reference. The code element may be deleted, renamed, or involved in a compiler error. When this happens, any calls to the CodeElement object will return the error message "Exception from HRESULT: 0x80047E2C."

Once a reference becomes invalid in this way, it cannot be recovered. To fix this problem, you need to fix any errors in the source code and retrieve a new reference from the CodeModel object.

The following macros demonstrate how this error might occur. Add a class named LostClass to your project. Make this a top-level class, not inside a namespace or class. Run the SetElement macro, delete the class, and then run the GetElement macro. When you run GetElement, the class no longer exists, and the lostClass reference is invalid and returns the error.

Public Module CreateLostClass

Dim lostClass As CodeElement

Sub SetElement()

Dim proj As Project = DTE.Solution.Projects.Item(1)

lostClass = proj.CodeModel.CodeElements.Item("LostClass")

MsgBox(lostClass.Name)

End Sub

Sub GetElement()

MsgBox(lostClass.Name)

End Sub

End Module

Posted

Well, guess what? Somehow, I managed to solve it.

 

For those of you interested to know how I managed it, here's what I did:

 

First: I commented out the entire code, so that my form displayed again.

Second: I uncommented small sections, flipping back to the Designer as I did.

Third: Got to some Click and Double Click events, and simply redid them the .NET way instead of uncommenting those sections.

 

Tada!

 

Thanks for listening to me ramble.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...