Click here to Skip to main content
14,769,593 members
Home » Discussions » C#
   

C#

 
AnswerRe: Data format for non-computerist editing Pin
Gerry Schmitz23-Dec-20 7:46
mveGerry Schmitz23-Dec-20 7:46 
AnswerRe: Data format for non-computerist editing Pin
Mycroft Holmes23-Dec-20 12:14
professionalMycroft Holmes23-Dec-20 12:14 
AnswerRe: Data format for non-computerist editing Pin
jschell29-Dec-20 7:54
Memberjschell29-Dec-20 7:54 
QuestionHow to address SQL CE file path? Pin
Alex Dunlop22-Dec-20 8:46
MemberAlex Dunlop22-Dec-20 8:46 
AnswerRe: How to address SQL CE file path? Pin
OriginalGriff22-Dec-20 9:45
mveOriginalGriff22-Dec-20 9:45 
QuestionWhy does NullReferenceException throw irrelevantly? I already tried - no success. Pin
Jens Eckervogt22-Dec-20 1:18
MemberJens Eckervogt22-Dec-20 1:18 
AnswerRe: Why does NullReferenceException throw irrelevantly? I already tried - no success. Pin
Richard MacCutchan22-Dec-20 2:06
mveRichard MacCutchan22-Dec-20 2:06 
AnswerRe: Why does NullReferenceException throw irrelevantly? I already tried - no success. Pin
OriginalGriff22-Dec-20 2:12
mveOriginalGriff22-Dec-20 2:12 
This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself.

Let me just explain what the error means: You have tried to use a variable, property, or a method return value but it contains null - which means that there is no instance of a class in the variable.
It's a bit like a pocket: you have a pocket in your shirt, which you use to hold a pen. If you reach into the pocket and find there isn't a pen there, you can't sign your name on a piece of paper - and you will get very funny looks if you try! The empty pocket is giving you a null value (no pen here!) so you can't do anything that you would normally do once you retrieved your pen. Why is it empty? That's the question - it may be that you forgot to pick up your pen when you left the house this morning, or possibly you left the pen in the pocket of yesterday's shirt when you took it off last night.

We can't tell, because we weren't there, and even more importantly, we can't even see your shirt, much less what is in the pocket!

Back to computers, and you have done the same thing, somehow - and we can't see your code, much less run it and find out what contains null when it shouldn't.
But you can - and Visual Studio will help you here. Run your program in the debugger and when it fails, VS will show you the line it found the problem on. You can then start looking at the various parts of it to see what value is null and start looking back through your code to find out why. So put a breakpoint at the beginning of the method containing the error line, and run your program from the start again. This time, VS will stop before the error, and let you examine what is going on by stepping through the code looking at your values.

But we can't do that - we don't have your code, we don't know how to use it if we did have it, we don't have your data. So try it - and see how much information you can find out!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!

AnswerRe: Why does NullReferenceException throw irrelevantly? I already tried - no success. Pin
Gerry Schmitz22-Dec-20 4:33
mveGerry Schmitz22-Dec-20 4:33 
SuggestionSQLLight vs SQL CE Pin
Alex Dunlop20-Dec-20 9:16
MemberAlex Dunlop20-Dec-20 9:16 
GeneralRe: SQLLight vs SQL CE Pin
Gerry Schmitz20-Dec-20 10:19
mveGerry Schmitz20-Dec-20 10:19 
GeneralRe: SQLLight vs SQL CE Pin
Mycroft Holmes20-Dec-20 12:15
professionalMycroft Holmes20-Dec-20 12:15 
QuestionHow to save panel content into PDF Pin
RedPandinus19-Dec-20 18:46
MemberRedPandinus19-Dec-20 18:46 
AnswerRe: How to save panel content into PDF Pin
OriginalGriff19-Dec-20 20:57
mveOriginalGriff19-Dec-20 20:57 
SuggestionRe: How to save panel content into PDF Pin
RedPandinus19-Dec-20 21:30
MemberRedPandinus19-Dec-20 21:30 
GeneralRe: How to save panel content into PDF Pin
OriginalGriff19-Dec-20 23:57
mveOriginalGriff19-Dec-20 23:57 
GeneralRe: How to save panel content into PDF Pin
RedPandinus20-Dec-20 7:07
MemberRedPandinus20-Dec-20 7:07 
GeneralAForge Motion Detection from PictureBox? Pin
Herboren19-Dec-20 18:15
MemberHerboren19-Dec-20 18:15 
GeneralRe: AForge Motion Detection from PictureBox? Pin
Gerry Schmitz19-Dec-20 22:51
mveGerry Schmitz19-Dec-20 22:51 
GeneralRe: AForge Motion Detection from PictureBox? Pin
Herboren20-Dec-20 7:09
MemberHerboren20-Dec-20 7:09 
GeneralRe: AForge Motion Detection from PictureBox? Pin
Gerry Schmitz20-Dec-20 10:30
mveGerry Schmitz20-Dec-20 10:30 
GeneralRe: AForge Motion Detection from PictureBox? Pin
Herboren20-Dec-20 13:47
MemberHerboren20-Dec-20 13:47 
GeneralRe: AForge Motion Detection from PictureBox? Pin
Gerry Schmitz21-Dec-20 7:52
mveGerry Schmitz21-Dec-20 7:52 
GeneralRe: AForge Motion Detection from PictureBox? Pin
Herboren21-Dec-20 9:31
MemberHerboren21-Dec-20 9:31 
GeneralRe: AForge Motion Detection from PictureBox? Pin
Gerry Schmitz21-Dec-20 9:57
mveGerry Schmitz21-Dec-20 9:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.