T
Tim Mulholland
Hopefully someone can point out what is going on here. I'll give a short
explanation first, then a more detailed one at the bottom if anyone wants to
dig into it more.
I have a strongly-typed dataset (from a .xsd file in my project) called
dsConfig.
When i make the following call:
dsConfig.ReadXml("buttons.xml", XmlReadMode.Auto);
i get the following error:
An unhandled exception of type 'System.NullReferenceException' occurred
in Unknown Module.
Additional information: Object reference not set to an instance of an
object.
HOWEVER.
If i change my call to this:
System.IO.FileStream fs = System.IO.File.OpenRead("buttons.xml");
dsConfig.ReadXml(fs, XmlReadMode.Auto);
then it executes properly.
Any ideas? Its not that complicated to do that, but it obviously shouldn't
be that way. More details at the bottom.
Thanks in advance!
Tim
-------------------------------------------------------
OK, so here are the details
I have a usercontrol (we'll call it A). inside of A, there is a function
(we'll call it DoStuff()) that executes the above line of code (the original
one that i said didn't work).
if i have an instance of A in a form, then A.DoStuff() executes with no
problems.
I then have an inherited usercontrol (we'll call it B) that inherits from A.
if i have an instance of B in a form, then B.DoStuff() executes with no
problems.
I then have a separate usercontrol (we'll call it C) that contains an
instance of B. In C, there is a function (we'll call it DoMoreStuff()) that
calls B.DoStuff(). If i have an instance of C on my form, and i call
C.DoMoreStuff(), then i get the error i listed above, and i can fix it only
with the above hack. The error actually occurs all the way down in the code
for A if i include all the projects. in the solution and step all the way
down into it.
Any ideas?
Tim
explanation first, then a more detailed one at the bottom if anyone wants to
dig into it more.
I have a strongly-typed dataset (from a .xsd file in my project) called
dsConfig.
When i make the following call:
dsConfig.ReadXml("buttons.xml", XmlReadMode.Auto);
i get the following error:
An unhandled exception of type 'System.NullReferenceException' occurred
in Unknown Module.
Additional information: Object reference not set to an instance of an
object.
HOWEVER.
If i change my call to this:
System.IO.FileStream fs = System.IO.File.OpenRead("buttons.xml");
dsConfig.ReadXml(fs, XmlReadMode.Auto);
then it executes properly.
Any ideas? Its not that complicated to do that, but it obviously shouldn't
be that way. More details at the bottom.
Thanks in advance!
Tim
-------------------------------------------------------
OK, so here are the details
I have a usercontrol (we'll call it A). inside of A, there is a function
(we'll call it DoStuff()) that executes the above line of code (the original
one that i said didn't work).
if i have an instance of A in a form, then A.DoStuff() executes with no
problems.
I then have an inherited usercontrol (we'll call it B) that inherits from A.
if i have an instance of B in a form, then B.DoStuff() executes with no
problems.
I then have a separate usercontrol (we'll call it C) that contains an
instance of B. In C, there is a function (we'll call it DoMoreStuff()) that
calls B.DoStuff(). If i have an instance of C on my form, and i call
C.DoMoreStuff(), then i get the error i listed above, and i can fix it only
with the above hack. The error actually occurs all the way down in the code
for A if i include all the projects. in the solution and step all the way
down into it.
Any ideas?
Tim