0

Possible Duplicate:
Unable to change DataRow value

I have the Two-dimensional datarow array like this

Datarow Mydatarow [][] = new Datarow[5][5] ;

and initial Mydatarow form database ... Now I Want to do this code and change Mydatarow value

Mydatarow [Index][i].ItemArray[3]= "S";

I use This Code to change Mydatarowvalue But it dos'nt work

Mydatarow [Index][i].BeginEdit();
Mydatarow [Index][i].SetModified();
Mydatarow [Index][i].ItemArray[3]= "S";
Mydatarow [Index][i].EndEdit(); 
Mydatarow [Index][i].AcceptChanges();

please help me to change datarow value

Community
  • 1
  • 1
Masoud Abasian
  • 10,549
  • 6
  • 23
  • 22

1 Answers1

0

You have a problem with declaring the array:

Datarow Mydatarow [][] = Datarow[5][5] ;

should be

Datarow[][] Mydatarow = new Datarow[5][];

So:

Mydatarow[Index][i].ItemArray[3]= "S";//should work fine
Jalal Said
  • 15,906
  • 7
  • 45
  • 68
  • Sorry For Bad Writing code ... i edit My question – Masoud Abasian Jul 30 '11 at 17:30
  • @Masoud are you facing any exception? if so what is it? – Jalal Said Jul 30 '11 at 18:09
  • No. it word good . but value don't change – Masoud Abasian Jul 30 '11 at 18:19
  • @Masoud the value doesn't change where? in a gird view? if you insert a break point at the line `Mydatarow[Index][i].ItemArray[3]= "S"` and run the project "F5", now when the function that execute that line triggers, the break point will stop at that line, now you should see the previous value of the `ItemArray` at index 3, now press f10 so only this line will be evaluated, you now will see that the value is actually changed.. – Jalal Said Jul 30 '11 at 18:32