System.NullReferenceException: Object reference not set to an instance of an object??? Huh???

Discussion in 'ASP.NET / ASP.NET Core' started by yorkshirela, Apr 5, 2005.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hello John. I don't have too much time to look at the code you posted. But I can tell you that (I least in my experience) "objectreference not to instance of an object" is related to a object not instantiated. Please put a bunch of break point and make sure you have instantiated all your objects.</o:p>
    </o:p>
    Keep in mind that some of them may have constructors which means you need New keyword while instantiating the object.</o:p>
     
  2. Maybe someone can help me out. I've been playing around with this form and haven't been able to get it to work. Oddly, the visibility code works independently and so does the Dim fp code, but when put together I get a "System.NullReferenceException: Object reference not set to an instance of an object" error message. I'm sure it isn't a big deal but I haven't been able to fix it on my own and I need some help. The code is below and the error message info is below the code.

    I learned asp.net on my own and I haven't a clue as to what a "instance of an object" is. When my kids grow up I'll have the time to learn it from scratch but, for now, I'm just a hack who reverse engineers code. Your help is appreciated.

    <code>
    <%@ Page Language="VB" Debug="true" ClassName="RSVP2Class" %><%@ Page Language="VB" Debug="true" ClassName="RSVP2Class" %><%@ Page Language="VB" Debug="true" ClassName="RSVP2Class" %><%@ Page Language="VB" Debug="true" ClassName="RSVP2Class" %><%@ Page Language="VB" Debug="true" ClassName="RSVP2Class" %><%@ Page Language="VB" Debug="true" ClassName="RSVP2Class" %><%@ Page Language="VB" Debug="true" ClassName="RSVP2Class" %> <%@ Page Language="VB" Debug="true" ClassName="RSVP2Class" %>
    <%@ Register TagPrefix="DP" Namespace="RicherComponents.DatePickerControl" Assembly="RichDatePicker, Version=1.6.0.0, Culture=neutral, PublicKeyToken=17b15412cfbf13c1" %>
    <%@ reference page="rsvp.aspx" %>
    <HTML>
    <HEAD>
    <title>Bounce 'N Fun! - Bouncer Reservation Form (Pg. 2 of 4)</title>
    <script runat="server">
    'Visibility toggle

    Sub Page_Load(s as object, e as eventargs)
    panelPage1.Visible = true 'if no want to display select false
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub
    Sub Page1Visible(s as object, e as eventargs)
    panelPage1.Visible = true
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub
    Sub Page2Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = true
    panelPage3.Visible = false
    End Sub
    Sub Page3Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = false
    panelPage3.Visible =true
    End Sub

    'Calling second page values below

    Public ReadOnly Property BouncerF() As String
    Get
    Return bouncer.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_TimeF() As string
    Get
    Return Event_time.SelectedDate
    End Get
    End Property
    Public ReadOnly Property Rental_timeF() As String
    Get
    Return rental_time.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_typeF() As String
    Get
    Return Event_type.SelectedItem.Text
    End Get
    End Property
    Dim fp As RSVP1Class
    Sub Page_Load()
    If Not IsPostBack Then
    fp = CType(Context.Handler, RSVP1Class)
    End If
    End Sub
    Sub TextBox_TextChanged(sender As Object, e As EventArgs)
    End Sub
    Sub Button2_Click(sender As Object, e As EventArgs)
    If Page.IsValid Then
    Server.Transfer("rsvp3.aspx", True)
    End If
    End Sub

    </script><%@ Register TagPrefix="DP" Namespace="RicherComponents.DatePickerControl" Assembly="RichDatePicker, Version=1.6.0.0, Culture=neutral, PublicKeyToken=17b15412cfbf13c1" %><%@ reference page="rsvp.aspx" %>
    <script runat="server">
    'Visibility toggle

    Sub Page_Load(s as object, e as eventargs)
    panelPage1.Visible = true 'if no want to display select false
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub
    Sub Page1Visible(s as object, e as eventargs)
    panelPage1.Visible = true
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub

    Sub Page2Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = true
    panelPage3.Visible = false
    End Sub

    Sub Page3Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = false
    panelPage3.Visible =true
    End Sub

    'Calling second page values below

    Public ReadOnly Property BouncerF() As String
    Get
    Return bouncer.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_TimeF() As string
    Get
    Return Event_time.SelectedDate
    End Get
    End Property

    Public ReadOnly Property Rental_timeF() As String
    Get
    Return rental_time.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_typeF() As String
    Get
    Return Event_type.SelectedItem.Text
    End Get
    End Property

    Dim fp As RSVP1Class
    Sub Page_Load()
    If Not IsPostBack Then
    fp = CType(Context.Handler, RSVP1Class)
    End If
    End Sub

    Sub TextBox_TextChanged(sender As Object, e As EventArgs)
    End Sub

    Sub Button2_Click(sender As Object, e As EventArgs)
    If Page.IsValid Then
    Server.Transfer("rsvp3.aspx", True)
    End If
    End Sub

    </script>
    <%@ Register TagPrefix="DP" Namespace="RicherComponents.DatePickerControl" Assembly="RichDatePicker, Version=1.6.0.0, Culture=neutral, PublicKeyToken=17b15412cfbf13c1" %><%@ reference page="rsvp.aspx" %>
    <script runat="server">
    'Visibility toggle

    Sub Page_Load(s as object, e as eventargs)
    panelPage1.Visible = true 'if no want to display select false
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub
    Sub Page1Visible(s as object, e as eventargs)
    panelPage1.Visible = true
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub

    Sub Page2Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = true
    panelPage3.Visible = false
    End Sub

    Sub Page3Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = false
    panelPage3.Visible =true
    End Sub

    'Calling second page values below

    Public ReadOnly Property BouncerF() As String
    Get
    Return bouncer.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_TimeF() As string
    Get
    Return Event_time.SelectedDate
    End Get
    End Property

    Public ReadOnly Property Rental_timeF() As String
    Get
    Return rental_time.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_typeF() As String
    Get
    Return Event_type.SelectedItem.Text
    End Get
    End Property

    Dim fp As RSVP1Class
    Sub Page_Load()
    If Not IsPostBack Then
    fp = CType(Context.Handler, RSVP1Class)
    End If
    End Sub

    Sub TextBox_TextChanged(sender As Object, e As EventArgs)
    End Sub

    Sub Button2_Click(sender As Object, e As EventArgs)
    If Page.IsValid Then
    Server.Transfer("rsvp3.aspx", True)
    End If
    End Sub

    </script>
    <%@ Register TagPrefix="DP" Namespace="RicherComponents.DatePickerControl" Assembly="RichDatePicker, Version=1.6.0.0, Culture=neutral, PublicKeyToken=17b15412cfbf13c1" %><%@ reference page="rsvp.aspx" %>
    <script runat="server">
    'Visibility toggle

    Sub Page_Load(s as object, e as eventargs)
    panelPage1.Visible = true 'if no want to display select false
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub
    Sub Page1Visible(s as object, e as eventargs)
    panelPage1.Visible = true
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub

    Sub Page2Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = true
    panelPage3.Visible = false
    End Sub

    Sub Page3Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = false
    panelPage3.Visible =true
    End Sub

    'Calling second page values below

    Public ReadOnly Property BouncerF() As String
    Get
    Return bouncer.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_TimeF() As string
    Get
    Return Event_time.SelectedDate
    End Get
    End Property

    Public ReadOnly Property Rental_timeF() As String
    Get
    Return rental_time.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_typeF() As String
    Get
    Return Event_type.SelectedItem.Text
    End Get
    End Property

    Dim fp As RSVP1Class
    Sub Page_Load()
    If Not IsPostBack Then
    fp = CType(Context.Handler, RSVP1Class)
    End If
    End Sub

    Sub TextBox_TextChanged(sender As Object, e As EventArgs)
    End Sub

    Sub Button2_Click(sender As Object, e As EventArgs)
    If Page.IsValid Then
    Server.Transfer("rsvp3.aspx", True)
    End If
    End Sub

    </script>
    <%@ Register TagPrefix="DP" Namespace="RicherComponents.DatePickerControl" Assembly="RichDatePicker, Version=1.6.0.0, Culture=neutral, PublicKeyToken=17b15412cfbf13c1" %><%@ reference page="rsvp.aspx" %>
    <script runat="server">
    'Visibility toggle

    Sub Page_Load(s as object, e as eventargs)
    panelPage1.Visible = true 'if no want to display select false
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub
    Sub Page1Visible(s as object, e as eventargs)
    panelPage1.Visible = true
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub

    Sub Page2Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = true
    panelPage3.Visible = false
    End Sub

    Sub Page3Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = false
    panelPage3.Visible =true
    End Sub

    'Calling second page values below

    Public ReadOnly Property BouncerF() As String
    Get
    Return bouncer.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_TimeF() As string
    Get
    Return Event_time.SelectedDate
    End Get
    End Property

    Public ReadOnly Property Rental_timeF() As String
    Get
    Return rental_time.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_typeF() As String
    Get
    Return Event_type.SelectedItem.Text
    End Get
    End Property

    Dim fp As RSVP1Class
    Sub Page_Load()
    If Not IsPostBack Then
    fp = CType(Context.Handler, RSVP1Class)
    End If
    End Sub

    Sub TextBox_TextChanged(sender As Object, e As EventArgs)
    End Sub

    Sub Button2_Click(sender As Object, e As EventArgs)
    If Page.IsValid Then
    Server.Transfer("rsvp3.aspx", True)
    End If
    End Sub

    </script>
    <%@ Register TagPrefix="DP" Namespace="RicherComponents.DatePickerControl" Assembly="RichDatePicker, Version=1.6.0.0, Culture=neutral, PublicKeyToken=17b15412cfbf13c1" %><%@ reference page="rsvp.aspx" %>
    <script runat="server">
    'Visibility toggle

    Sub Page_Load(s as object, e as eventargs)
    panelPage1.Visible = true 'if no want to display select false
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub
    Sub Page1Visible(s as object, e as eventargs)
    panelPage1.Visible = true
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub

    Sub Page2Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = true
    panelPage3.Visible = false
    End Sub

    Sub Page3Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = false
    panelPage3.Visible =true
    End Sub

    'Calling second page values below

    Public ReadOnly Property BouncerF() As String
    Get
    Return bouncer.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_TimeF() As string
    Get
    Return Event_time.SelectedDate
    End Get
    End Property

    Public ReadOnly Property Rental_timeF() As String
    Get
    Return rental_time.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_typeF() As String
    Get
    Return Event_type.SelectedItem.Text
    End Get
    End Property

    Dim fp As RSVP1Class
    Sub Page_Load()
    If Not IsPostBack Then
    fp = CType(Context.Handler, RSVP1Class)
    End If
    End Sub

    Sub TextBox_TextChanged(sender As Object, e As EventArgs)
    End Sub

    Sub Button2_Click(sender As Object, e As EventArgs)
    If Page.IsValid Then
    Server.Transfer("rsvp3.aspx", True)
    End If
    End Sub

    </script>
    <%@ Register TagPrefix="DP" Namespace="RicherComponents.DatePickerControl" Assembly="RichDatePicker, Version=1.6.0.0, Culture=neutral, PublicKeyToken=17b15412cfbf13c1" %><%@ reference page="rsvp.aspx" %>
    <script runat="server">
    'Visibility toggle

    Sub Page_Load(s as object, e as eventargs)
    panelPage1.Visible = true 'if no want to display select false
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub
    Sub Page1Visible(s as object, e as eventargs)
    panelPage1.Visible = true
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub

    Sub Page2Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = true
    panelPage3.Visible = false
    End Sub

    Sub Page3Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = false
    panelPage3.Visible =true
    End Sub

    'Calling second page values below

    Public ReadOnly Property BouncerF() As String
    Get
    Return bouncer.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_TimeF() As string
    Get
    Return Event_time.SelectedDate
    End Get
    End Property

    Public ReadOnly Property Rental_timeF() As String
    Get
    Return rental_time.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_typeF() As String
    Get
    Return Event_type.SelectedItem.Text
    End Get
    End Property

    Dim fp As RSVP1Class
    Sub Page_Load()
    If Not IsPostBack Then
    fp = CType(Context.Handler, RSVP1Class)
    End If
    End Sub

    Sub TextBox_TextChanged(sender As Object, e As EventArgs)
    End Sub

    Sub Button2_Click(sender As Object, e As EventArgs)
    If Page.IsValid Then
    Server.Transfer("rsvp3.aspx", True)
    End If
    End Sub

    </script>
    <%@ Register TagPrefix="DP" Namespace="RicherComponents.DatePickerControl" Assembly="RichDatePicker, Version=1.6.0.0, Culture=neutral, PublicKeyToken=17b15412cfbf13c1" %><%@ reference page="rsvp.aspx" %>
    <script runat="server">
    'Visibility toggle

    Sub Page_Load(s as object, e as eventargs)
    panelPage1.Visible = true 'if no want to display select false
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub
    Sub Page1Visible(s as object, e as eventargs)
    panelPage1.Visible = true
    panelPage2.Visible = false
    panelPage3.Visible = false
    End Sub

    Sub Page2Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = true
    panelPage3.Visible = false
    End Sub

    Sub Page3Visible(s as object, e as eventargs)
    panelPage1.Visible = false
    panelPage2.Visible = false
    panelPage3.Visible =true
    End Sub

    'Calling second page values below

    Public ReadOnly Property BouncerF() As String
    Get
    Return bouncer.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_TimeF() As string
    Get
    Return Event_time.SelectedDate
    End Get
    End Property

    Public ReadOnly Property Rental_timeF() As String
    Get
    Return rental_time.SelectedItem.Text
    End Get
    End Property

    Public ReadOnly Property Event_typeF() As String
    Get
    Return Event_type.SelectedItem.Text
    End Get
    End Property

    Dim fp As RSVP1Class
    Sub Page_Load()
    If Not IsPostBack Then
    fp = CType(Context.Handler, RSVP1Class)
    End If
    End Sub

    Sub TextBox_TextChanged(sender As Object, e As EventArgs)
    End Sub

    Sub Button2_Click(sender As Object, e As EventArgs)
    If Page.IsValid Then
    Server.Transfer("rsvp3.aspx", True)
    End If
    End Sub

    </script>

    </code>

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

    Source Error:





    Code:
    Line 123:		<form id="theform" method="post" runat="server" action="rsvp3.aspx">
    Line 124:			<table width="750" align="center">
    Line 125:				<input type="hidden" value="<%=fp.NameF%>" name="name"/> <input type="hidden" value="<%=fp.addressF%>" name="address"/>
    Line 126:				<input type="hidden" value="<%=fp.address2F%>" name="address2"/> <input type="hidden" value="<%=fp.cityF%>" name="city"/>
    Line 127:				<input type="hidden" value="<%=fp.stateF%>" name="state"/> <input type="hidden" value="<%=fp.zipF%>" name="zip"/>
    Source File: E:\web\bouncenfunb\htdocs\RSVP_FORM\rsvp2.aspx Line: 125

    "
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page