Re: [ASP.Net2] Object reference not set to an instance of an object.



My first question would be, is there a textbox in the page? My second
question would be, is it named "txtBox"?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Complex things are made up of
Lots of simple things.

"WONG Chi Kit Keith" <civkit@xxxxxxxxxxx> wrote in message
news:%23kgZS0d5FHA.2888@xxxxxxxxxxxxxxxxxxxxxxx
When the following script is processed, errors return:
Partial Class _Default
Inherits System.Web.UI.Page


Public Sub New()
Me.txtBox.Text = "This is a text box."
End Sub
End Class

Error:

Server Error in '/' Application.
--------------------------------------------------------------------------------

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 5:
Line 6: Public Sub New()
Line 7: Me.txtBox.Text = "This is a text box."
Line 8: End Sub
Line 9: End Class

Source File: f:\inetpub\wwwroot\Default.aspx.vb Line: 7

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.]
_Default..ctor() in c:\inetpub\wwwroot\Default.aspx.vb:7
ASP.default_aspx..ctor() in c:\inetpub\wwwroot\Default.aspx.vb:912304
__ASP.FastObjectFactory_app_web_rzbiactk.Create_ASP_default_aspx() +38
System.Web.Compilation.BuildResultCompiledType.CreateInstance() +49
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath
virtualPath, Type requiredBaseType, HttpContext context, Boolean
allowCrossApp, Boolean noAssert) +115
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context,
String requestType, VirtualPath virtualPath, String physicalPath) +31
System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext
context, String requestType, VirtualPath virtualPath, String physicalPath)
+40
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String
requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
+139
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+120
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +155



.



Relevant Pages

  • MOSS Search Recurrent Event Log Errors
    ... (VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, ... (HttpContext context, VirtualPath virtualPath, Boolean noBuild, ... (HttpContext context, String verb, String url, String filePath) ...
    (microsoft.public.sharepoint.portalserver)
  • Re: vb script or asp.net problem - not sure where to begin
    ... i uninstalled asp.net 2.0 and just running iis with whatever is default ... >> virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean ... >> String requestType, VirtualPath virtualPath, String physicalPath) ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: newbie: Need help with this bug/exception
    ... Boolean checkAptcaBit, Boolean ignoreCase) ... String propertyName, ConfigurationElement configElement, Boolean ... configProviders, ProviderCollection providers, Type providerType) ... context, String requestType, VirtualPath virtualPath, String physicalPath) ...
    (microsoft.public.dotnet.framework.aspnet)
  • Cannot login to PWA from a computer other than the install server
    ... access PWA on the server where I installed Project Server. ... isWebServiceCall, Boolean newCookie, Guid siteId, Nullable`1 zone) +366 ... String requestType, VirtualPath virtualPath, String physicalPath) +31 ...
    (microsoft.public.project)
  • Re: Does GridView.DataBind work under medium trust with custom obj
    ... virtualPath, Type requiredBaseType, HttpContext context, Boolean ... System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, ... String requestType, VirtualPath virtualPath, String physicalPath) +306 ...
    (microsoft.public.dotnet.framework.aspnet)

Quantcast