473,508 Members | 2,240 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TypeInitializationException thrown

6 New Member
Hi,

i hav two classes as following;

class1.cs
----------
namespace NAS
{
// fields
// properties

public class Class1
{
public Class1() {}
}

// member methods
// ...
}



class2.cs
-----------
namespace NAS
{
public class Class2
{
private Class1 class1Obj;

public void Meth()
{
class1Obj = new Class1(); // here i get an error
} // it throws TypeInitializationException
}
}

when i create an object of Class1 under Class2, i m getting
TypeInitializationException.
But i hav referred the class corretly in Reference..

Please help me..
NAS
Feb 2 '07 #1
1 1466
RedSon
5,000 Recognized Expert Expert
This looks right. Have you included class1 in your class2 project? Class2 must know what a Class1 object is and how to create one. Here is some additional information about Classes for C#.
Feb 2 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
6343
by: Ethan | last post by:
I made a program that works fine as long as its on my machine, but as soon as i move it to a network drive it stops working. I'm still trying to run it on my machine just from a network drive and...
1
2214
by: sys | last post by:
I made a smart client that I purposed to offer on a web server. But when I try to run it by dint of Internet Explorer, I get the System.TypeInitializationException in the IEExec.exe thread. My...
0
1555
by: cnu | last post by:
Hi, I have a windows form application that works well in my computer in debug and release modes from IDE and windows explorer. I do XCOPY deployment on other computer. When I run the applicaiton...
0
1624
by: Sagaert Johan | last post by:
this code using System; using System.Net.Sockets; namespace ConsoleApplication1 { /// <summary> /// Summary description for Class1. /// </summary>
1
1242
by: Roshan Hadal via .NET 247 | last post by:
We are able to run our application succesfully through .Net IDE.When we try to run the .EXE of the same(created and installedthrough SetUp package) a type initialization...
3
3681
by: linaj | last post by:
Hi, I have singleton class in C#: class Logger { static Logger lInstance = new Logger(); private Logger() {}
18
7095
by: Zytan | last post by:
I just got a TypeInitializationException exception. Why it is a common cause for this? The InnerException is System.FormatException, although I don't see anything requesting something to be...
0
601
by: =?Utf-8?B?TWFyY3VzIFNjaGFlZmVy?= | last post by:
Hi everybody, I'm working on my application for appr. 2 years and now suddenly I got an System.TypeInitializationException in one of my global modules. The error is thrown at the first call of a...
1
2243
by: =?Utf-8?B?UGhpbGlwIFdhZ2VuYWFy?= | last post by:
I have an ASP.NET application that is showing throwing an strange exception in my Virtual PC environment. We have encoutered this error at a customer running our product on Virtual Server. At the...
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7132
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4720
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.