Results 1 to 4 of 4

Thread: [RESOLVED] Why/How to solve inherited form error.

  1. #1

    Thread Starter
    Frenzied Member FishGuy's Avatar
    Join Date
    Mar 2005
    Location
    Bradford UK
    Posts
    1,708

    Resolved [RESOLVED] Why/How to solve inherited form error.

    Hi,
    I have a form Called NewCall, I also have a form addNote which inherits from NewCall.

    In the NewCall load event I have
    VB Code:
    1. RecommendID = objDatabase.SqlDVFillRecommends(objMainform.grdCallingList.CurrentRowIndex)("PK_RecommendID").ToString()

    The Program compiles fine and runs fine its just that this piece of code is causing an error to appear at design time on when opening the inherited form in design view.
    Null Reference Exception object reference not set to an instance of an object.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Why/How to solve inherited form error.

    Presumably the objects you are using are created when instantiating the base class. It would appear that whatever code is responsible for that is not being executed when instantiating the derived class. You should have a good look at the code for both classes and see why this would be the case.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member FishGuy's Avatar
    Join Date
    Mar 2005
    Location
    Bradford UK
    Posts
    1,708

    Re: Why/How to solve inherited form error.

    But why do I only get the error when not executing the code, it only appears in design view?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Why/How to solve inherited form error.

    I don't know all the details but while the designer does call constructors and things like that, circumstances are different at design time than at run time. You can put MessageBox calls in your code and see them at design time, which might help. Note too that the Component class has a DesignTime property that you can use to male things happen differently at design time and run time. If you're classes are forms then they indirectly inherit Component so they will have this property.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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