Error that I can't figure out

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • YYZ

    #1

    Error that I can't figure out

    "Code generation for property 'LienPos' failed. Error was: 'Object
    reference not set to an instance of an object.'"

    I get this when, in design mode (ie, not running at all) I bring up the
    designer for a usercontrol. This usercontrol (currently named
    ucTestLoan.vb) contains and instance of another usercontrol, called
    ucLoanScenario.

    That ucLoanScenario contains a public property called LienPos. LienPos
    is dimmed as clsListItem -- clsListItem is just a custom class that I
    built that has a couple of properties.

    I see this error in the Task List of the IDE listed as an error. If I
    double click on the error it takes me to the very first line in
    ucTestLoan. That doesn't really help me pinpoint where the error is.
    Is there some sort of Error checking option I can enable to find out
    exactly where and why this error is cropping up?

    If I compile the project, it compiles and runs fine.

    Any ideas?

    Matt

  • Fred Hedges

    #2
    Re: Error that I can't figure out


    There are a few ways of doing this, one of which is to open a new instance
    of Visual Studio and "attach" the debugger to the first instance, making
    sure you are "breaking into debugger" on appropriate exceptions. I think a
    VP here gave this suggestion some time ago and I use it from time-to-time
    but cannot find a link to the thread.

    Another thing to do is put "If Me.DesignMode Then Exit Sub" at appropriate
    places in properties or methods in your class (such as "New") to see if that
    fixes things, or causes more problems.

    I used to want my controls to be functional on that level when I was in
    design mode - for example connecting to a database, fetching records and
    displaying them on the form designer, but these days I don't feel it's a
    good idea to modify program logic to make these scenarios work, so I blank
    out with DesignMode before anything interesting happens inside a control,
    saving the real work for run-time.



    "YYZ" <matt.dawdy@gma il.com> escribió en el mensaje
    news:1147963386 .809564.178800@ g10g2000cwb.goo glegroups.com.. .[color=blue]
    > "Code generation for property 'LienPos' failed. Error was: 'Object
    > reference not set to an instance of an object.'"
    >
    > I get this when, in design mode (ie, not running at all) I bring up the
    > designer for a usercontrol. This usercontrol (currently named
    > ucTestLoan.vb) contains and instance of another usercontrol, called
    > ucLoanScenario.
    >
    > That ucLoanScenario contains a public property called LienPos. LienPos
    > is dimmed as clsListItem -- clsListItem is just a custom class that I
    > built that has a couple of properties.
    >
    > I see this error in the Task List of the IDE listed as an error. If I
    > double click on the error it takes me to the very first line in
    > ucTestLoan. That doesn't really help me pinpoint where the error is.
    > Is there some sort of Error checking option I can enable to find out
    > exactly where and why this error is cropping up?
    >
    > If I compile the project, it compiles and runs fine.
    >
    > Any ideas?
    >
    > Matt
    >[/color]


    Comment

    • Chris

      #3
      Re: Error that I can't figure out

      YYZ wrote:[color=blue]
      > "Code generation for property 'LienPos' failed. Error was: 'Object
      > reference not set to an instance of an object.'"
      >
      > I get this when, in design mode (ie, not running at all) I bring up the
      > designer for a usercontrol. This usercontrol (currently named
      > ucTestLoan.vb) contains and instance of another usercontrol, called
      > ucLoanScenario.
      >
      > That ucLoanScenario contains a public property called LienPos. LienPos
      > is dimmed as clsListItem -- clsListItem is just a custom class that I
      > built that has a couple of properties.
      >
      > I see this error in the Task List of the IDE listed as an error. If I
      > double click on the error it takes me to the very first line in
      > ucTestLoan. That doesn't really help me pinpoint where the error is.
      > Is there some sort of Error checking option I can enable to find out
      > exactly where and why this error is cropping up?
      >
      > If I compile the project, it compiles and runs fine.
      >
      > Any ideas?
      >
      > Matt
      >[/color]

      I always got this when I did stuff in the paint event. Goes along with
      Fred's sub new comment.

      Chris

      Comment

      • YYZ

        #4
        Re: Error that I can't figure out

        Thanks for that, Fred (and Chris). I haven't been able to track it
        down yet, but I'm trying the Designmode thing.

        I tried to attach a debugger, but VS just crashed. Not sure if I have
        all updates to VS2003, so I'll check that as well.

        Matt

        Comment

        Working...