开发者

Bug : Object reference not set to an instance of an object [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, i开发者_开发问答ncomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

Object reference not set to an instance of an object.

i am getting this error on line by line validation.can any one help me.............?


It means you're trying to dereference a null reference. Something like this:

string text = null;
int length = text.Length;

Without seeing any code, it's impossible for us to advise you any further. Basically, find out which reference is null and work out how to handle it or prevent it occurring.


You are trying to use an uninitialized variable in your code.

Make sure all variables are initialized before using them:

string x = null;
x.Replace(' ', 'x'); // Exception: Object reference not set to an instance of an object.

string y = "This is a test";
y.Replace(' ', 'x'); // No problem, y = "Thisxisxaxtest"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜