Showing posts with label instance. Show all posts
Showing posts with label instance. Show all posts

Saturday, March 31, 2012

Strande inheritance problem

I have two classes, one called frame1 and the other frame2.

In frame2 i import the frame1, and i also create an instance of it.

The problem is that in class frame1 i have an control declared:

Public WithEvents labelNameLogin As System.Web.UI.WebControls.Label

And when a try for eg, access to it a get an error:

If vObjFrameBoard.labelNameLogin.Text = "" Then -- error

'some code

Exit Sub

error:Object reference not set to an instance of an object

But if a try to access to an of its variables, declared as public a have no problem.
So where is the problem.

Thanks in advanceDoesnt anybody know how to solve this. I really need your help.
Thx
Thx for your help anyway.

Here is the soluction for the problem i was having.

Public WithEvents TextBox1 As System.Web.UI.WebControls.TextBox = New System.Web.UI.WebControls.TextBox

i tought the instance was done automatically, like when building an stand alone application.

Strange "Object reference not set to an instance of an object" error in webform

I suddenly received an unexpected error in my project. I have been working
on this project for some time without this issue. Nothing has changed in the
form that caused the exception. A little experimentation shows that I cannot
run ANY .NET web project without getting this error:

-----------------------
--

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:

Line 1: <%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false"
Codebehind="Login.aspx.vb" Inherits="DataBayWeb.Login" %>
Line 2: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Line 3: <HTML
Source File: c:\inetpub\wwwroot\DataBayWeb\login.aspx Line: 1

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.]
System.Web.UI.Control.get_Controls()
System.Web.UI.Control.AddParsedSubObject(Object obj)

System.Web.UI.Control.System.Web.UI.IParserAccesso r.AddParsedSubObject(Objec
t obj)
ASP.Login_aspx.__BuildControlTree(Control __ctrl) in
c:\inetpub\wwwroot\DataBayWeb\login.aspx:1
ASP.Login_aspx.FrameworkInitialize()
System.Web.UI.Page.ProcessRequest()
System.Web.UI.Page.ProcessRequest(HttpContext context)

System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication+IExecutionSte
p.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously)

Other developers on my team can run the latest version of the project
without an issue. What has happened?

ChrisVery strange indeed. It might sound obscure, but try removing the
space in <%@. Page...

Otherwise, I would be tempted to do the inevitable and reinstall the
framework.

Simon.

Strange "Object reference not set to an instance of an object" error in web

I suddenly received an unexpected error in my project. I have been working
on this project for some time without this issue. Nothing has changed in the
form that caused the exception. A little experimentation shows that I cannot
run ANY .NET web project without getting this error:
----
--
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 1: <%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false"
Codebehind="Login.aspx.vb" Inherits="DataBayWeb.Login" %>
Line 2: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Line 3: <HTML>
Source File: c:\inetpub\wwwroot\DataBayWeb\login.aspx Line: 1
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
System.Web.UI.Control.get_Controls()
System.Web.UI.Control.AddParsedSubObject(Object obj)
System.Web.UI.Control.System.Web.UI.IParserAccessor.AddParsedSubObject(Objec
t obj)
ASP.Login_aspx.__BuildControlTree(Control __ctrl) in
c:\inetpub\wwwroot\DataBayWeb\login.aspx:1
ASP.Login_aspx.FrameworkInitialize()
System.Web.UI.Page.ProcessRequest()
System.Web.UI.Page.ProcessRequest(HttpContext context)
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionSte
p.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)
Other developers on my team can run the latest version of the project
without an issue. What has happened?
ChrisVery strange indeed. It might sound obscure, but try removing the
space in <%@. Page...
Otherwise, I would be tempted to do the inevitable and reinstall the
framework.
Simon.

Saturday, March 24, 2012

Strange Exception with WebMethod

Hi All,

I'm experienceing a new and strange problem with a WebMethod I am working
on. It creates an instance of a class which contains a number of fields,
Collections, and classes, all of which are serializable (I'm pretty sure).
It compiles fine, and when I run it, I can step through all of the code I
wrote without exception, but it returns the following message:

"There was an error generating the XML document. --> index is outside the
bounds of this Collection"

Anyone have a clue as to where to find the answer to this? I haven't been
able to Google a thing.

--
Thanks,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a livingDoes this error happen only through code or does it happen if you hit the
ASMX through an application like Web Service Studio (or the local test
page)? If it only happens in code, The place to look would be the
reference.vb file.

You don't have to use the generated classes in the reference.vb, you can
erase them and add whatever imports are neccesary to make it use your
original classes. This might be a good troubleshooting step.

"Kevin Spencer" <kspencer@.takempis.com> wrote in
news:#kAQxftuEHA.1524@.TK2MSFTNGP09.phx.gbl:

> Hi All,
> I'm experienceing a new and strange problem with a WebMethod I am
> working on. It creates an instance of a class which contains a number
> of fields, Collections, and classes, all of which are serializable
> (I'm pretty sure). It compiles fine, and when I run it, I can step
> through all of the code I wrote without exception, but it returns the
> following message:
> "There was an error generating the XML document. --> index is outside
> the bounds of this Collection"
> Anyone have a clue as to where to find the answer to this? I haven't
> been able to Google a thing.
Thanks,

I figured it out. There actually WAS an exception occurring, which was being
trapped. When I stepped through the code, I stepped over the method call
that raised the exception. Fortunately, I was also logging exceptions, so
when I went into the log I found the exception and the source of it.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"cbDevelopment" <development@.remove.700cb.net> wrote in message
news:Xns958FD359943E9cbDevelopment@.207.46.248.16.. .
> Does this error happen only through code or does it happen if you hit the
> ASMX through an application like Web Service Studio (or the local test
> page)? If it only happens in code, The place to look would be the
> reference.vb file.
> You don't have to use the generated classes in the reference.vb, you can
> erase them and add whatever imports are neccesary to make it use your
> original classes. This might be a good troubleshooting step.
>
> "Kevin Spencer" <kspencer@.takempis.com> wrote in
> news:#kAQxftuEHA.1524@.TK2MSFTNGP09.phx.gbl:
> > Hi All,
> > I'm experienceing a new and strange problem with a WebMethod I am
> > working on. It creates an instance of a class which contains a number
> > of fields, Collections, and classes, all of which are serializable
> > (I'm pretty sure). It compiles fine, and when I run it, I can step
> > through all of the code I wrote without exception, but it returns the
> > following message:
> > "There was an error generating the XML document. --> index is outside
> > the bounds of this Collection"
> > Anyone have a clue as to where to find the answer to this? I haven't
> > been able to Google a thing.

Strange Exception with WebMethod

Hi All,
I'm experienceing a new and strange problem with a WebMethod I am working
on. It creates an instance of a class which contains a number of fields,
Collections, and classes, all of which are serializable (I'm pretty sure).
It compiles fine, and when I run it, I can step through all of the code I
wrote without exception, but it returns the following message:
"There was an error generating the XML document. --> index is outside the
bounds of this Collection"
Anyone have a clue as to where to find the answer to this? I haven't been
able to Google a thing.
Thanks,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a livingDoes this error happen only through code or does it happen if you hit the
ASMX through an application like Web Service Studio (or the local test
page)? If it only happens in code, The place to look would be the
reference.vb file.
You don't have to use the generated classes in the reference.vb, you can
erase them and add whatever imports are neccesary to make it use your
original classes. This might be a good troubleshooting step.
"Kevin Spencer" <kspencer@.takempis.com> wrote in
news:#kAQxftuEHA.1524@.TK2MSFTNGP09.phx.gbl:

> Hi All,
> I'm experienceing a new and strange problem with a WebMethod I am
> working on. It creates an instance of a class which contains a number
> of fields, Collections, and classes, all of which are serializable
> (I'm pretty sure). It compiles fine, and when I run it, I can step
> through all of the code I wrote without exception, but it returns the
> following message:
> "There was an error generating the XML document. --> index is outside
> the bounds of this Collection"
> Anyone have a clue as to where to find the answer to this? I haven't
> been able to Google a thing.
>
Thanks,
I figured it out. There actually WAS an exception occurring, which was being
trapped. When I stepped through the code, I stepped over the method call
that raised the exception. Fortunately, I was also logging exceptions, so
when I went into the log I found the exception and the source of it.
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
"cbDevelopment" <development@.remove.700cb.net> wrote in message
news:Xns958FD359943E9cbDevelopment@.207.46.248.16...
> Does this error happen only through code or does it happen if you hit the
> ASMX through an application like Web Service Studio (or the local test
> page)? If it only happens in code, The place to look would be the
> reference.vb file.
> You don't have to use the generated classes in the reference.vb, you can
> erase them and add whatever imports are neccesary to make it use your
> original classes. This might be a good troubleshooting step.
>
> "Kevin Spencer" <kspencer@.takempis.com> wrote in
> news:#kAQxftuEHA.1524@.TK2MSFTNGP09.phx.gbl:
>
>