Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. The type initializer threw an exception.

The type initializer threw an exception.

Scheduled Pinned Locked Moved Visual Basic
helpdatabase
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nanda1605
    wrote on last edited by
    #1

    Hi, I am getting the 'Type initializer error' in module1 (for eg see the below code). The thing is i want to get the value from the dll which is added as a reference to this exe, where the value is declared in the module. Please Review the below code and suggest/help me. Project1.dll Module Module1 Public MyPath As String = "C:\Nanda" End Module Public Class Class1 Public Sub Query() MsgBox(MyPath, MsgBoxStyle.Information, "Project1") End Sub End Class Project2.exe Public Class Form1 Public MyReport As New Project1.Class1 Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MyReport.Query() End Sub End Class

    Thanks, Nanda

    L 1 Reply Last reply
    0
    • N Nanda1605

      Hi, I am getting the 'Type initializer error' in module1 (for eg see the below code). The thing is i want to get the value from the dll which is added as a reference to this exe, where the value is declared in the module. Please Review the below code and suggest/help me. Project1.dll Module Module1 Public MyPath As String = "C:\Nanda" End Module Public Class Class1 Public Sub Query() MsgBox(MyPath, MsgBoxStyle.Information, "Project1") End Sub End Class Project2.exe Public Class Form1 Public MyReport As New Project1.Class1 Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MyReport.Query() End Sub End Class

      Thanks, Nanda

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Nanda1605 wrote:

      MsgBox(MyPath, MsgBoxStyle.Information, "Project1")

      Try this: MsgBox(Module1.MyPath, MsgBoxStyle.Information, "Project1")

      Cheers, Karl My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your Articles

      Just a grain of sand on the worlds beaches.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups