I am using Asp.net/C# ,, i have declared an integer array as follows public int[] recno;
As i dont know the exact size of the array ,, however inside a function i get to know its size based on the number of customer_id's in the table.Here is the function
public void GetRecordNo()
{
recid = from id in dt.cust_masters
select id;
recno = new int[recid.Count()];
for (int i = 0; i < recid.Count(); i++)
{
recno[i] = Convert.ToInt32(recid.ElementAt(i).customer_id);
}
}
When i try to call a function ShowRecord(int index) which accepts the id of the customer in the following manner
ShowRecord(recno[0])
It gives me an error
Object reference not set to an instance of an object.
Can anybody point me where am i going wrong. Thanks