jeevan mummadi

jeevan mummadi

  • NA
  • 157
  • 0

holding data in strings between function calls

May 8 2008 3:18 AM

 

hello,

     i have written a code like this:

 

namespace servercommunication

{

public partial class Form1 : Form

{

static int k = 0;

static string[] data = new string[150];

 

public void OnDataReceived()

{

 

string[] temp1 = new string[150];

temp1[0]="1234";

    if(k==0)

{

   data[0]=temp1[0];

k++;

}

else

{

data[k]=temp1[0];

}

}

 

when the first function is called if(k==0) will execute,but when second time function is called data[0] has no data,i.e., it's showing "".what could be the problem


Answers (1)