Friday, May 14, 2010

object reference not set to an instance of an object C#

Error: object reference not set to an instance of an object

C# developer usually getting the above error, I'd suggeste first check where you are using Trim(), Substring(), Length(), ToUpper(), ToLower() function with string variables in your codind.

To Resolve:
if(!String.IsNullOrEmpty(userFirstName))
{

-- your userFirstName assignment code here
}

No comments: