Last post Aug 30, 2018 03:45 AM by Larry Inge
Aug 27, 2018 07:36 PM|rtaVix|LINK
I am getting the following error: System.NullReferenceException: 'Object reference not set to an instance of an object.'
When I try to go through the lines of my code, to read the bar code field it returns the error just above, it does not even pass the line InBarCodes = true;
Aug 27, 2018 11:02 PM|Larry Inge|LINK
At line five you set
vi = null;
I can't see anywhere that you give vi a value so, when you try to use vi later it is null. You need to initialize vi at some point so that there is an object that you can reference.
Aug 28, 2018 12:33 AM|rtaVix|LINK
Is there better programming practice to read this file?
Aug 28, 2018 10:16 PM|Larry Inge|LINK
Don't let better be the enemy of good.
The first thing you need, and the most important by a long, long, long way, is a program that works.
If you want to save information in an object then you have to actual have an object.
If you want to put water in a bucket then you have to have a bucket.
In other words, the best way to read a file is the way that satisfies your business needs and lets you move onto the next component of your application.
Aug 29, 2018 01:22 AM|rtaVix|LINK
Where would you like to come with your friend's comment: Don't let better be the enemy of good.?
If you want to contribute with some suggestion of your own as being closer to my problem, I thank you again.
Friend, I've posted my questions, comments and my code here for help, re-reading your supposed suggestions, I can not find your solution at any time in your posts presented here, if possible and if you still want to contribute your tip, Could I please review
my content, which was elaborated with great care and did not detract from its contribution? Your lines do not look like the doubt I'm having in your two comments.
Aug 30, 2018 02:24 AM|Larry Inge|LINK
I can not find your solution at any time in your posts presented here
The solution is right there in my first reply
You need to initialize vi at some point so that there is an object that you can reference.
I can't write the code for you. You haven't given the definition of the
class so I don't know what constructors are available to you. I don't know the full business situation so I can't know which of the constructors would be the best to use.
You don't need a better program. You just need one that works.
Aug 30, 2018 03:05 AM|rtaVix|LINK
Yes, I had noticed before you said it, but it still does not work. But thank you for contributing to the topic.
Aug 30, 2018 03:45 AM|Larry Inge|LINK
it still does not work
Can you supply a little more detail?
Show the new code. Show the new error. Tell us what happens and the circumstances. Tell us what you expect to happen.