DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Marty Guest

    Web User Control


    Why am I constantly getting this error

    "Object reference not set to an instance of an object"

    When I placed a web user control onto my webform. I declare a variable for
    it. My sample code is as follows:


    'Declare variable here
    Public usi As ShowSchedule

    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
    WorkIT()
    End Sub
    Public Sub WorkIT()
    usi.CreateSchedule()
    End Sub
    End Class

    The moment it hits the line usi.CreateScheudle it causes the error.

    Thanks in advance

    Marty

  2. #2
    Guest

    Re: Web User Control



    "Object reference not set to an instance of an object"

    This is the .NET way of saying you haven't created your object correctly.
    You've declared it, but not created it. Depending on how you have constructed
    your class, I would venture that the remedy is to insert the New keyword
    in your declaration.

    Public usi As New ShowSchedule()



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links