473,804 Members | 3,004 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

class library

Hi !

I created a class library and in it I have a class that call
"ConfigurationM anager" to find out what type of database I work and the
connection string.When I call this class from a form, everithing is running
well, no errors.When I call this class from a custom control I receive the
message "Object reference not set to an instance of an object"
Does anyoane know what is happening ?

Thanks,
Mihai
Oct 10 '06 #1
8 2429
Mihai,

You have somewhere not instanced an object, try to find that in your code.
For us that is impossible, this newsgroup has not the possibility to look
through that video camera on your head.

Cor

"Mihai Velicu" <bv*****@telus. netschreef in bericht
news:ihCWg.6769 $P7.2840@edtnps 89...
Hi !

I created a class library and in it I have a class that call
"ConfigurationM anager" to find out what type of database I work and the
connection string.When I call this class from a form, everithing is
running well, no errors.When I call this class from a custom control I
receive the message "Object reference not set to an instance of an object"
Does anyoane know what is happening ?

Thanks,
Mihai

Oct 10 '06 #2
So this line work perfectly if from a form I call the class that contain
this line
mConnectionStri ng =
ConfigurationMa nager.Connectio nStrings(DataBa seConnectionNam e).ConnectionSt ring.ToString()

In a custom control that reside in a control library if i call the class
that reside in a library class and that has somewhere in a method this line,
is not working.Gave me that error message.

So don't be rude with comments like that one bellow.I tried a couple of
hours to see what is happening - debugging and serching in MSDN but
unfortunately with no results.That why I ask help on this newsgroup.

Regards,
Mihai
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:Om******** *****@TK2MSFTNG P03.phx.gbl...
Mihai,

You have somewhere not instanced an object, try to find that in your code.
For us that is impossible, this newsgroup has not the possibility to look
through that video camera on your head.

Cor

"Mihai Velicu" <bv*****@telus. netschreef in bericht
news:ihCWg.6769 $P7.2840@edtnps 89...
>Hi !

I created a class library and in it I have a class that call
"Configuration Manager" to find out what type of database I work and the
connection string.When I call this class from a form, everithing is
running well, no errors.When I call this class from a custom control I
receive the message "Object reference not set to an instance of an
object"
Does anyoane know what is happening ?

Thanks,
Mihai


Oct 10 '06 #3
Mihai,

Don't you find your own question rude, asking something and giving not any
information. Is your configuration manager a shared class or has it to be
instanced, nothing that you show.

There should be a reason why it is not working, but even with this simple
code string we cannot see it, you suppose we start a kind of guessing
context. There is not a kind of wonder that protects it to be working in
this situation.

However as most people than reply, we don't have to anwer your questions, we
just can ignore it.

Cor

"Mihai Velicu" <bv*****@telus. netschreef in bericht
news:uaFWg.4579 $P7.1012@edtnps 90...
So this line work perfectly if from a form I call the class that contain
this line
mConnectionStri ng =
ConfigurationMa nager.Connectio nStrings(DataBa seConnectionNam e).ConnectionSt ring.ToString()

In a custom control that reside in a control library if i call the class
that reside in a library class and that has somewhere in a method this
line, is not working.Gave me that error message.

So don't be rude with comments like that one bellow.I tried a couple of
hours to see what is happening - debugging and serching in MSDN but
unfortunately with no results.That why I ask help on this newsgroup.

Regards,
Mihai
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:Om******** *****@TK2MSFTNG P03.phx.gbl...
>Mihai,

You have somewhere not instanced an object, try to find that in your
code. For us that is impossible, this newsgroup has not the possibility
to look through that video camera on your head.

Cor

"Mihai Velicu" <bv*****@telus. netschreef in bericht
news:ihCWg.676 9$P7.2840@edtnp s89...
>>Hi !

I created a class library and in it I have a class that call
"Configuratio nManager" to find out what type of database I work and the
connection string.When I call this class from a form, everithing is
running well, no errors.When I call this class from a custom control I
receive the message "Object reference not set to an instance of an
object"
Does anyoane know what is happening ?

Thanks,
Mihai



Oct 10 '06 #4

Mihai Velicu wrote:
Hi !

I created a class library and in it I have a class that call
"ConfigurationM anager" to find out what type of database I work and the
connection string.When I call this class from a form, everithing is running
well, no errors.When I call this class from a custom control I receive the
message "Object reference not set to an instance of an object"
Does anyoane know what is happening ?

Thanks,
Mihai
Mihai,

Can you give show us your app.config (obviously, change any sensitive
data :)... And maybe the method where you are calling this.

Thanks,

--
Tom Shelton

Oct 10 '06 #5
I'm using Factory model to determine at runtime what kind of database I'm
using and to get the connection string from app.config.

I'm using the "ConfigurationM anager " static class provided by .Net
framework 2.0.

I marked in the code where the error is. I repeat again, from a form
everithing is running properly only from a user control that reside in a
control library is the problem. It seems I have to declare somehow the
static method in the code .
because the ConfigurationMa nager is a static method I cannot use New....

If you want to help me
Create a control library and in it, a control and put this code and try to
execute and you can see the results I mean the error message.You have to add
reference to System.Configur ation.
Bellow is the code and App.Config.

Thank you very much !
Mihai

The code is :

Imports System
Imports System.Data
Imports System.Data.Com mon
Imports System.Configur ation
Public Class NrSystemForAcco unts
'Private gts As GenericDb.Gener icDbWrapper.Gen ericTableServic es
Private dt As DataTable
Private mConnectionStri ng As String
Private mFactoryName As String
Private mFactory As DbProviderFacto ry
Private mFactoryConnect ion As DbConnection
Private mFactoryCommand As DbCommand
Private mDataAdapter As DbDataAdapter

Private Sub SetFactory(ByVa l DataBaseConnect ionName As String)

!!!!!!!! The error is in the line bellow :"Object reference not set to an
instance of an object"

mConnectionStri ng =
ConfigurationMa nager.Connectio nStrings(DataBa seConnectionNam e).ConnectionSt r
ing.ToString()
mFactoryName =
ConfigurationMa nager.Connectio nStrings(DataBa seConnectionNam e).ProviderName .
ToString()
mFactory = DbProviderFacto ries.GetFactory (mFactoryName)
End Sub

Private Sub NrSystemForAcco unts_Load(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles MyBase.Load
Me.SetFactory(" DatabaseConnect ion1")
End sub
End class
The App.config code is :

<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>
<!-- This section defines the connections and database providers -->
<connectionStri ngs>

<add name="DatabaseC onnection1"
connectionStrin g="Persist Security Info=False;Inte grated
Security=SSPI;d atabase=Conta;s erver=(local);"
providerName="S ystem.Data.SqlC lient" />
<add name="DatabaseC onnection2"
connectionStrin g="" providerName="O racle" />
</connectionStrin gs>

<system.diagnos tics>
<sources>
<!-- This section defines the logging configuration for
My.Application. Log -->
<source name="DefaultSo urce" switchName="Def aultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSw itch" value="Informat ion" />
</switches>
<sharedListener s>
<add name="FileLog"
type="Microsoft .VisualBasic.Lo gging.FileLogTr aceListener,
Microsoft.Visua lBasic, Version=8.0.0.0 , Culture=neutral ,
PublicKeyToken= b03f5f7f11d50a3 a, processorArchit ecture=MSIL"
initializeData= "FileLogWri ter"/>
<!-- Uncomment the below section and replace APPLICATION_NAM E with the name
of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Di agnostics.Event LogTraceListene r"
initializeData= "APPLICATION_NA ME"/-->
</sharedListeners >
</system.diagnost ics>
</configuration>

"Mihai Velicu" <bv*****@telus. netwrote in message
news:ihCWg.6769 $P7.2840@edtnps 89...
Hi !

I created a class library and in it I have a class that call
"ConfigurationM anager" to find out what type of database I work and the
connection string.When I call this class from a form, everithing is
running
well, no errors.When I call this class from a custom control I receive the
message "Object reference not set to an instance of an object"
Does anyoane know what is happening ?

Thanks,
Mihai


Oct 11 '06 #6
Hi Mihai,

If you're trying to access data from an app.config file from a Class Library
(*.dll), the name of the config file must be the name of the callling
assembly.

For example say I have a Windows Forms EXE app called "MyProgram. exe" which
references a class library called "MyLibrary.dll" . Inside my library, I make
the call:

mConnectionStri ng =
ConfigurationMa nager.Connectio nStrings(DataBa seConnectionNam e).ConnectionSt r
ing.ToString()

Now, if the config file is not name "MyProgram.exe. config" (it should NOT be
named "MyLibrary.dll. config"), or if the connection string does not exist in
the file, a NULL (Nothing) value will be returned at this portion of the
statement:

ConfigurationMa nager.Connectio nStrings(DataBa seConnectionNam e)

Now since this part of the statement is returning Nothing, calling the
".ConnectionStr ing.ToString()" part will throw the exception you are seeing.
I would recommend doing something like this:

Dim connStrings As ConnectionStrin gSettingsCollec tion
connStrings = ConfigurationMa nager.Connectio nStrings

Dim conStr As ConnectionStrin gSettings
conStr = connStrs(DataBa seConnectionNam e)

If conStr Is Nothing then
Throw New Exception("App. config or connection string not found")
end If

If the exception gets thrown through the if statement check, then there's a
good change the DLL can not find the app.config file. Make sure your
connection strings are defined in the App.config file of the Calling Assembly
(of the .exe project).

"Mihai" wrote:
I'm using Factory model to determine at runtime what kind of database I'm
using and to get the connection string from app.config.

I'm using the "ConfigurationM anager " static class provided by .Net
framework 2.0.

I marked in the code where the error is. I repeat again, from a form
everithing is running properly only from a user control that reside in a
control library is the problem. It seems I have to declare somehow the
static method in the code .
because the ConfigurationMa nager is a static method I cannot use New....

If you want to help me
Create a control library and in it, a control and put this code and try to
execute and you can see the results I mean the error message.You have to add
reference to System.Configur ation.
Bellow is the code and App.Config.

Thank you very much !
Mihai

The code is :

Imports System
Imports System.Data
Imports System.Data.Com mon
Imports System.Configur ation
Public Class NrSystemForAcco unts
'Private gts As GenericDb.Gener icDbWrapper.Gen ericTableServic es
Private dt As DataTable
Private mConnectionStri ng As String
Private mFactoryName As String
Private mFactory As DbProviderFacto ry
Private mFactoryConnect ion As DbConnection
Private mFactoryCommand As DbCommand
Private mDataAdapter As DbDataAdapter

Private Sub SetFactory(ByVa l DataBaseConnect ionName As String)

!!!!!!!! The error is in the line bellow :"Object reference not set to an
instance of an object"

mConnectionStri ng =
ConfigurationMa nager.Connectio nStrings(DataBa seConnectionNam e).ConnectionSt r
ing.ToString()
mFactoryName =
ConfigurationMa nager.Connectio nStrings(DataBa seConnectionNam e).ProviderName .
ToString()
mFactory = DbProviderFacto ries.GetFactory (mFactoryName)
End Sub

Private Sub NrSystemForAcco unts_Load(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles MyBase.Load
Me.SetFactory(" DatabaseConnect ion1")
End sub
End class
The App.config code is :

<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>
<!-- This section defines the connections and database providers -->
<connectionStri ngs>

<add name="DatabaseC onnection1"
connectionStrin g="Persist Security Info=False;Inte grated
Security=SSPI;d atabase=Conta;s erver=(local);"
providerName="S ystem.Data.SqlC lient" />
<add name="DatabaseC onnection2"
connectionStrin g="" providerName="O racle" />
</connectionStrin gs>

<system.diagnos tics>
<sources>
<!-- This section defines the logging configuration for
My.Application. Log -->
<source name="DefaultSo urce" switchName="Def aultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSw itch" value="Informat ion" />
</switches>
<sharedListener s>
<add name="FileLog"
type="Microsoft .VisualBasic.Lo gging.FileLogTr aceListener,
Microsoft.Visua lBasic, Version=8.0.0.0 , Culture=neutral ,
PublicKeyToken= b03f5f7f11d50a3 a, processorArchit ecture=MSIL"
initializeData= "FileLogWri ter"/>
<!-- Uncomment the below section and replace APPLICATION_NAM E with the name
of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Di agnostics.Event LogTraceListene r"
initializeData= "APPLICATION_NA ME"/-->
</sharedListeners >
</system.diagnost ics>
</configuration>

"Mihai Velicu" <bv*****@telus. netwrote in message
news:ihCWg.6769 $P7.2840@edtnps 89...
Hi !

I created a class library and in it I have a class that call
"ConfigurationM anager" to find out what type of database I work and the
connection string.When I call this class from a form, everithing is
running
well, no errors.When I call this class from a custom control I receive the
message "Object reference not set to an instance of an object"
Does anyoane know what is happening ?

Thanks,
Mihai


Oct 12 '06 #7
Thank you very much for you answer.I disturb you once again.Please tell me
in what book I can find what you told me because belive me or not a read a
lot and it seems for nothing.The usualy books don't have any reference to
something like that.

Thank you very much again,
Maihai

"rmacias" <rm*****@newsgr oup.nospamwrote in message
news:17******** *************** ***********@mic rosoft.com...
Hi Mihai,

If you're trying to access data from an app.config file from a Class
Library
(*.dll), the name of the config file must be the name of the callling
assembly.

For example say I have a Windows Forms EXE app called "MyProgram. exe"
which
references a class library called "MyLibrary.dll" . Inside my library, I
make
the call:

mConnectionStri ng =
ConfigurationMa nager.Connectio nStrings(DataBa seConnectionNam e).ConnectionSt r
ing.ToString()

Now, if the config file is not name "MyProgram.exe. config" (it should NOT
be
named "MyLibrary.dll. config"), or if the connection string does not exist
in
the file, a NULL (Nothing) value will be returned at this portion of the
statement:

ConfigurationMa nager.Connectio nStrings(DataBa seConnectionNam e)

Now since this part of the statement is returning Nothing, calling the
".ConnectionStr ing.ToString()" part will throw the exception you are
seeing.
I would recommend doing something like this:

Dim connStrings As ConnectionStrin gSettingsCollec tion
connStrings = ConfigurationMa nager.Connectio nStrings

Dim conStr As ConnectionStrin gSettings
conStr = connStrs(DataBa seConnectionNam e)

If conStr Is Nothing then
Throw New Exception("App. config or connection string not found")
end If

If the exception gets thrown through the if statement check, then there's
a
good change the DLL can not find the app.config file. Make sure your
connection strings are defined in the App.config file of the Calling
Assembly
(of the .exe project).

"Mihai" wrote:
>I'm using Factory model to determine at runtime what kind of database I'm
using and to get the connection string from app.config.

I'm using the "ConfigurationM anager " static class provided by .Net
framework 2.0.

I marked in the code where the error is. I repeat again, from a form
everithing is running properly only from a user control that reside in a
control library is the problem. It seems I have to declare somehow the
static method in the code .
because the ConfigurationMa nager is a static method I cannot use New....

If you want to help me
Create a control library and in it, a control and put this code and try
to
execute and you can see the results I mean the error message.You have to
add
reference to System.Configur ation.
Bellow is the code and App.Config.

Thank you very much !
Mihai

The code is :

Imports System
Imports System.Data
Imports System.Data.Com mon
Imports System.Configur ation
Public Class NrSystemForAcco unts
'Private gts As GenericDb.Gener icDbWrapper.Gen ericTableServic es
Private dt As DataTable
Private mConnectionStri ng As String
Private mFactoryName As String
Private mFactory As DbProviderFacto ry
Private mFactoryConnect ion As DbConnection
Private mFactoryCommand As DbCommand
Private mDataAdapter As DbDataAdapter

Private Sub SetFactory(ByVa l DataBaseConnect ionName As String)

!!!!!!!! The error is in the line bellow :"Object reference not set to an
instance of an object"

mConnectionStri ng =
ConfigurationM anager.Connecti onStrings(DataB aseConnectionNa me).ConnectionS tr
ing.ToString ()
mFactoryName =
ConfigurationM anager.Connecti onStrings(DataB aseConnectionNa me).ProviderNam e.
ToString()
mFactory = DbProviderFacto ries.GetFactory (mFactoryName)
End Sub

Private Sub NrSystemForAcco unts_Load(ByVal sender As System.Object, ByVal
e
As System.EventArg s) Handles MyBase.Load
Me.SetFactory(" DatabaseConnect ion1")
End sub
End class
The App.config code is :

<?xml version="1.0" encoding="utf-8" ?>
<configuration >
<!-- This section defines the connections and database providers -->
<connectionStr ings>

<add name="DatabaseC onnection1"
connectionStrin g="Persist Security Info=False;Inte grated
Security=SSPI; database=Conta; server=(local); "
providerName="S ystem.Data.SqlC lient" />
<add name="DatabaseC onnection2"
connectionStrin g="" providerName="O racle" />
</connectionStrin gs>

<system.diagno stics>
<sources>
<!-- This section defines the logging configuration for
My.Application .Log -->
<source name="DefaultSo urce" switchName="Def aultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event
Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSw itch" value="Informat ion" />
</switches>
<sharedListene rs>
<add name="FileLog"
type="Microsof t.VisualBasic.L ogging.FileLogT raceListener,
Microsoft.Visu alBasic, Version=8.0.0.0 , Culture=neutral ,
PublicKeyToken =b03f5f7f11d50a 3a, processorArchit ecture=MSIL"
initializeData ="FileLogWriter "/>
<!-- Uncomment the below section and replace APPLICATION_NAM E with the
name
of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Di agnostics.Event LogTraceListene r"
initializeData ="APPLICATION_N AME"/-->
</sharedListeners >
</system.diagnost ics>
</configuration>

"Mihai Velicu" <bv*****@telus. netwrote in message
news:ihCWg.676 9$P7.2840@edtnp s89...
Hi !

I created a class library and in it I have a class that call
"ConfigurationM anager" to find out what type of database I work and
the
connection string.When I call this class from a form, everithing is
running
well, no errors.When I call this class from a custom control I receive
the
message "Object reference not set to an instance of an object"
Does anyoane know what is happening ?

Thanks,
Mihai




Oct 12 '06 #8
Honestly, a person can not learn to be a good troubleshooter and a good
programmer by reading books. Actually coding, debugging, making mistakes,
and learning from those mistakes is what makes a good coder. Experience
will always be the best teacher. It just takes some time. I hope this is
something you have learned and will remember the next time something like
this comes up.

Good luck!!

"Mihai Velicu" wrote:
Thank you very much for you answer.I disturb you once again.Please tell me
in what book I can find what you told me because belive me or not a read a
lot and it seems for nothing.The usualy books don't have any reference to
something like that.

Thank you very much again,
Maihai

"rmacias" <rm*****@newsgr oup.nospamwrote in message
news:17******** *************** ***********@mic rosoft.com...
Hi Mihai,

If you're trying to access data from an app.config file from a Class
Library
(*.dll), the name of the config file must be the name of the callling
assembly.

For example say I have a Windows Forms EXE app called "MyProgram. exe"
which
references a class library called "MyLibrary.dll" . Inside my library, I
make
the call:

mConnectionStri ng =
ConfigurationMa nager.Connectio nStrings(DataBa seConnectionNam e).ConnectionSt r
ing.ToString()

Now, if the config file is not name "MyProgram.exe. config" (it should NOT
be
named "MyLibrary.dll. config"), or if the connection string does not exist
in
the file, a NULL (Nothing) value will be returned at this portion of the
statement:

ConfigurationMa nager.Connectio nStrings(DataBa seConnectionNam e)

Now since this part of the statement is returning Nothing, calling the
".ConnectionStr ing.ToString()" part will throw the exception you are
seeing.
I would recommend doing something like this:

Dim connStrings As ConnectionStrin gSettingsCollec tion
connStrings = ConfigurationMa nager.Connectio nStrings

Dim conStr As ConnectionStrin gSettings
conStr = connStrs(DataBa seConnectionNam e)

If conStr Is Nothing then
Throw New Exception("App. config or connection string not found")
end If

If the exception gets thrown through the if statement check, then there's
a
good change the DLL can not find the app.config file. Make sure your
connection strings are defined in the App.config file of the Calling
Assembly
(of the .exe project).

"Mihai" wrote:
I'm using Factory model to determine at runtime what kind of database I'm
using and to get the connection string from app.config.

I'm using the "ConfigurationM anager " static class provided by .Net
framework 2.0.

I marked in the code where the error is. I repeat again, from a form
everithing is running properly only from a user control that reside in a
control library is the problem. It seems I have to declare somehow the
static method in the code .
because the ConfigurationMa nager is a static method I cannot use New....

If you want to help me
Create a control library and in it, a control and put this code and try
to
execute and you can see the results I mean the error message.You have to
add
reference to System.Configur ation.
Bellow is the code and App.Config.

Thank you very much !
Mihai

The code is :

Imports System
Imports System.Data
Imports System.Data.Com mon
Imports System.Configur ation
Public Class NrSystemForAcco unts
'Private gts As GenericDb.Gener icDbWrapper.Gen ericTableServic es
Private dt As DataTable
Private mConnectionStri ng As String
Private mFactoryName As String
Private mFactory As DbProviderFacto ry
Private mFactoryConnect ion As DbConnection
Private mFactoryCommand As DbCommand
Private mDataAdapter As DbDataAdapter

Private Sub SetFactory(ByVa l DataBaseConnect ionName As String)

!!!!!!!! The error is in the line bellow :"Object reference not set to an
instance of an object"

mConnectionStri ng =
ConfigurationMa nager.Connectio nStrings(DataBa seConnectionNam e).ConnectionSt r
ing.ToString()
mFactoryName =
ConfigurationMa nager.Connectio nStrings(DataBa seConnectionNam e).ProviderName .
ToString()
mFactory = DbProviderFacto ries.GetFactory (mFactoryName)
End Sub

Private Sub NrSystemForAcco unts_Load(ByVal sender As System.Object, ByVal
e
As System.EventArg s) Handles MyBase.Load
Me.SetFactory(" DatabaseConnect ion1")
End sub
End class
The App.config code is :

<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>
<!-- This section defines the connections and database providers -->
<connectionStri ngs>

<add name="DatabaseC onnection1"
connectionStrin g="Persist Security Info=False;Inte grated
Security=SSPI;d atabase=Conta;s erver=(local);"
providerName="S ystem.Data.SqlC lient" />
<add name="DatabaseC onnection2"
connectionStrin g="" providerName="O racle" />
</connectionStrin gs>

<system.diagnos tics>
<sources>
<!-- This section defines the logging configuration for
My.Application. Log -->
<source name="DefaultSo urce" switchName="Def aultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event
Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSw itch" value="Informat ion" />
</switches>
<sharedListener s>
<add name="FileLog"
type="Microsoft .VisualBasic.Lo gging.FileLogTr aceListener,
Microsoft.Visua lBasic, Version=8.0.0.0 , Culture=neutral ,
PublicKeyToken= b03f5f7f11d50a3 a, processorArchit ecture=MSIL"
initializeData= "FileLogWri ter"/>
<!-- Uncomment the below section and replace APPLICATION_NAM E with the
name
of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Di agnostics.Event LogTraceListene r"
initializeData= "APPLICATION_NA ME"/-->
</sharedListeners >
</system.diagnost ics>
</configuration>

"Mihai Velicu" <bv*****@telus. netwrote in message
news:ihCWg.6769 $P7.2840@edtnps 89...
Hi !

I created a class library and in it I have a class that call
"ConfigurationM anager" to find out what type of database I work and
the
connection string.When I call this class from a form, everithing is
running
well, no errors.When I call this class from a custom control I receive
the
message "Object reference not set to an instance of an object"
Does anyoane know what is happening ?

Thanks,
Mihai




Oct 12 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
1966
by: syd | last post by:
In my project, I've got dozens of similar classes with hundreds of description variables in each. In my illustrative example below, I have a Library class that contains a list of Nation classes. In one case, I might want a Library class with only Nations of with the continent variable "Europe", and so I'll do something like library.getContinent('Europe') which will return a Library() instance with only European nations. Similarly, I...
6
6182
by: Patrick | last post by:
Following earlier discussions about invoking a .NET class library via ..NET-COM Interop (using regasm /tlb) at http://groups.google.com/groups?hl=en&lr=&threadm=%23Van7eSrEHA.4004%40TK2MSFTNGP10.phx.gbl&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26selm%3D%2523Van7eSrEHA.4004%2540TK2MSFTNGP10.phx.gbl I have concluded that my .NET class library (following the suggestions. namely setting the marshall type, etc.) , I can 1) Invoke public methods...
4
1771
by: Brian Shannon | last post by:
I am playing around with class libraries trying to understand how they work. I created a class library, library.vb. I placed the library.dll into the bin directory and set my reference. If I update the library.dll can I Just place the new .dll in the bin directory or do I need to recompile my program. During testing I am just placing the new library.dll in the bin directory and don't get any of the updates I made until I re-reference...
3
1644
by: eBob.com | last post by:
I have several applications which mine web sites for personal information which they publish. They publish the info in one form, I transform the info into Excel spreadsheets. So all these programs pick up name, telephone number, age, sex, etc.. And as they pick up the information they display it in text boxes. The text boxes are display only, and the info is displayed only for debugging purposes. Right now I have a lot of duplicate...
5
1948
by: Tony Johansson | last post by:
Hello! I have one solution file that consist of three project. One project that build the exe file called A One project that build a user control dll. Here we have a class called B One project that build a class library dll. Here we have a class called C We have one dependency and that is from the user control to the class library because in the constructor for class B in the user control we have a call to
0
1757
by: tony | last post by:
Hello! I have one solution file that consist of three project. One project that build the exe file called A One project that build a user control dll. In this user control we have a class called B One project that build a class library dll. In this class library we have a class called C In the user control project I have a project reference to the class library.
5
2000
by: tony | last post by:
Hello! This is a rather long mail but it's a very interesting one. I hope you read it. I have tried several times to get an answer to this mail but I have not get any answer saying something like this is a bug or that .NET doesn't support what I trying to do. I hope that one that is is microsoft certified read this because this must be a bug.
5
8616
by: Rainer Queck | last post by:
Hello NG, Is it possible to share the settings of an application with a class libreary? In my case I have a application and a set of different reports (home made) put into a class library. The plan is to delivere different report.dlls with the main app. But it is essentially importent, that the reports and the app use the same settings.
0
2411
by: drawing in aspnet | last post by:
Question about putting the data layer in a separate class library. I keep reading that the data layer should be separated from the presentation layer and put in its own class library. I am trying to do this but running into a problem. I'm hoping someone can point me in the right direction. I first create a class library (all code in C#) and within this class library create a very simple Sql Server Express database (.mdb) file. It's...
4
1391
by: Steve Baer | last post by:
I've already tested this with C# and it works, but I'm being paranoid and I wanted to also check here. Our application has a large class library written in C++/CLI for plug-in projects. The original library was written in C++ and the general rule for not breaking our SDK is to not change the class size by adding member variables and to not add virtual functions because this will change the vtable for the class. This is fine and we know...
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9577
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10569
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9140
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.