Getting exception -> "The type initializer for 'myProject.myModule' threw an exception."

Posted on 2009-02-18
Last Modified: 2012-05-06
Hi Guys,

I really need help for this issue.

I have .net windows application written in vb with a module (MyModule) that as the declaration of a variable with the following declaration:

Public GblDocuWareInicioAberto As Boolean

When i try to set the value of this variable on the form class i get the exception:
"The type initializer for 'myProject.myModule' threw an exception."

I dont know what is happening here. This application has been updated to framework 3.5 and since then it has this error.

Kind Regards.

// The Module

Option Explicit On 

Imports System.Data

Imports System.Data.SqlClient

Imports System.Globalization

Imports System.Threading

Module myModule

Public GblDocuWareInicioAberto As Boolean

End Module

// The call from the form class

Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

GblDocuWareInicioAberto = True

End Sub

Open in new window

Question by:r_guerreiro
    1 Comment
    LVL 2

    Accepted Solution

    I really dont know what was happening. I just deleted the module and created a new one. After that i renamed the variable name. Now it's working.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    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…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    755 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

    22 Experts available now in Live!

    Get 1:1 Help Now