Results 1 to 4 of 4

Thread: Object reference not set to an instance of an object.

  1. #1

    Thread Starter
    Frenzied Member TomGibbons's Avatar
    Join Date
    Feb 2002
    Location
    San Diego, CA Previous Location: UK
    Posts
    1,345

    Object reference not set to an instance of an object.

    When I run this code:
    Code:
    tblMain.InnerHtml = "<tr><td>I'm sorry, you did not fill out one or more required "+
    	"fields (Title and or description). Please <a href=\"javascript:history.go(-1)\">go back</a> "+
    	"try again.</td></tr>";
    tblMain is a HtmlTable which is defined as protected at the top and is set to runat server Any ideas? It's in C# in case you'd not noticed

    Thanks

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Object reference not set to an instance of an object.

    Originally posted by TomGibbons
    tblMain is a HtmlTable which is defined as protected at the top ....

    Thanks
    But has it been instanciated? Defining is one thing, but it doesn't do much good until the instance is actualy created.

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    I've never tried to do that as i'd say the majority of the time there will always be a better way of doing that sort of thing but anyway...... I just tried the same thing and get a different error message
    Code:
    'HtmlTable' does not support the InnerHtml property.
    are you certain that this is the point where your code is failing?

  4. #4

    Thread Starter
    Frenzied Member TomGibbons's Avatar
    Join Date
    Feb 2002
    Location
    San Diego, CA Previous Location: UK
    Posts
    1,345
    Originally posted by Fishcake
    I've never tried to do that as i'd say the majority of the time there will always be a better way of doing that sort of thing but anyway...... I just tried the same thing and get a different error message
    Code:
    'HtmlTable' does not support the InnerHtml property.
    are you certain that this is the point where your code is failing?
    Ah, I wasn't getting that error message. Either way, I've gone about it a different way now and I'm getting the result I was after.

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width