Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I recently installed Visual Studio 2003 upgrade and made sure that the .net framework on my computer has been upgraded too.

Now the .aspx page I am working on is giving me a "System.NullReferenceException: Object reference not set to an instance of an object" error.

Here is my code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   'Put user code to initialize the page here
   Dim dtmDate As Date
   dtmDate = DateTime.Now

   txtReqDate.Text = dtmDate.ToShortDateString
   success = True
   added = True
 End Sub

It worked in the previous version of Visual Studio.

Any ideas as to why this is happening? I would appreciate any help.

  • Leaders
Posted
I don't know much of anything about asp, but since dtmDate is clearly declared and assigned an object the only other reference in that line that could be null would be txtReqDate. Is the MyBase.Load event fired before the controls are created? If so then that would explain a NullReferenceException, and if not, I would be awefully confused.
[sIGPIC]e[/sIGPIC]
Posted
I don't understand why this worked in the old version of VS.Net and not in the new version. I tried searching the MSDN KB but couldn't find anything. *sigh* Their search leaves alot to be desired...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...