I am working on a .NET project in which i should get data from a web service and then show this data in a telerik report. The thing is that my code goes to exception "object reference not set to an instance of an object."
public CertifikatePersonale(string ssn)
{
string COUNTY = null;
string FATHER_NAME = null;
try
{
ArrayList list = new ArrayList();
SkyServices service = new SkyServices();
object [] merrcertifikate = getPerCertificate(ssn);
for (int i = 0; i < merrcertifikate.Length; i++)
{
string SSN = ((string)(merrcertifikate[1]));
string LAST_NAME = ((string)(merrcertifikate[2]));
FATHER_NAME = ((string)(merrcertifikate[3]));
string ADDRESS = ((string)(merrcertifikate[4]));
string GENDER = ((string)(merrcertifikate[5]));
string BIRTH_PLACE = ((string)(merrcertifikate[6]));
string BIRTH_DATE = ((string)(merrcertifikate[7]));
string MOTHER_NAME = ((string)(merrcertifikate[8]));
string MARITAL_STATUS = ((string)(merrcertifikate[9]));
COUNTY = ((string)(merrcertifikate[10]));
string DOCUMENT_TYPE = ((string)(merrcertifikate[11]));
string DOCUMENT_ISSUE_DATE = ((string)(merrcertifikate[12]));
string DOCUMENT_EXPIRATION_DATE = ((string)(merrcertifikate[13]));
string RESPONSE = ((string)(merrcertifikate[14]));
string RESPONSE_DATA = ((string)(merrcertifikate[15]));
}
txb_Nation.Value = COUNTY.ToString().ToUpper();
}
catch { }
}
the row
txb_Nation.Value = COUNTY.ToString().ToUpper();
leads to exception even that County has a value. Please help, this is taking more time than it should. Thank you
If COUNTY
really has a value, then it must be txb_Nation
that's not initialized. Your code does not show where that reference comes from; check if its value is properly set.