Sasikumar S

Sasikumar S

  • NA
  • 29
  • 36.7k

Unable to assign string value to 2D array

Aug 1 2011 3:49 AM
Hi friends,
While i am trying to parse the string and assign each string into two dimensional array it raising errors. my code shown below

String[][] location =null;
String sIPAddress="Chennai@tamilnadu@india");
int j = 0;
rt.Text = string.Empty;
for (int i = 0; i < sIPAddress.Length; i++)
{
ipvalue = sIPAddress[i].ToString();
locate= getlocate(ipvalue);
String[] str = locate.Split('@');
foreach(string place in str)
{
j = j + 1;
location[i][j] = place;
}
j = 0;
}


error message:

Object reference not set to an instance of an object


is there any solutions to solve this problem..

regards
sasi

Answers (3)