Error that I can't figure out

  • Thread starter Thread starter YYZ
  • Start date Start date
Y

YYZ

"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
 
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 said:
"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

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

Chris
 
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
 
Back
Top