Object reference not set to an instance of an object error

T

Tim Zych

A web form in my app is not running anymore. Whenever I try to do an action,
I get an error:

Server Error in '/codelib' Application.
----------------------------------------------------------------------------
----
Object reference not set to an instance of an object.


weird thing is that I just posted this app live yesterday and it works fine
on my web host. I try to run it from VS.Net and I can't.
Commenting out various code lines does not help. Even the simplest actions
return the same error.

Why would this occur and how can I fix it?

I'm using .net 1.0.
 
T

Tim Zych

Ok, I think the error was because the dropdown list had nothing in it and
the code was trying to use a value from it.

I had assumed the Page_Load event was getting triggered (which is is not).

Interesting, the Page_Load event is working on my host, but not in VS.Net.

I am wondering if it has anything to do with the extra code that VS.Net
adds. I see a difference between the version I did w/o VS.Net and the VS.Net
version. VS.Net adds more code:

For example in VS.Net I see:
Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load

but in the notepad version this suffices:

Sub Page_Load(Source As Object, E As EventArgs)

I suppose the framework does not require all of the additional code that
VS.Net adds?

At least it is working now.
 
A

Andy Gaskell

I'm not sure about VB.NET, but when editing ASP.NET files in C# VS.NET loves
to erase event handlers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top