Hot to solve object reference not set to instant of an object RRS feed

  • Question

  • HI

    i have one class Name A 

    when i call it to use 

    dim a as new A() 


    but it display message Object reference not set to and instance of an object.

    How can i solve this?

    • Moved by Mike Feng Thursday, January 3, 2013 3:22 AM restructure .NET forums (From:POS for .NET)
    • Moved by Mike Feng Thursday, January 3, 2013 5:14 AM restructure .NET forums (From:.NET Base Class Library)
    • Moved by Mike Feng Thursday, January 3, 2013 5:38 AM restructure .NET forums (From:POS for .NET)
    Wednesday, December 19, 2012 9:32 AM

All replies

  • Hi Rathanak,

    Welcome to the MSDN Forum.

    What is the shows method?

    Best regards,

    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, January 4, 2013 3:35 AM
  • The correct syntax is probably:


    You have to notice that you have to override the ToString() method in class A to return the right text (by default ToString() returns the class name ("A" in this case).

    If your problem is more complex, please provides more complex source code (at least of the A.shows function and/or the content text of the StackStrace member of the Object reference not set to an instance of an object exception.

    Thursday, February 14, 2013 1:05 AM