datagrid cell text

gl3nt0n

Newcomer
Joined
Dec 28, 2004
Messages
2
hey folks!

i'm trying to clear some cells in a datagrid, and can't figure out how to do it. here's what i got so far :

Code:
//clear the three last columns
for (i=3;i<=5;i++)
  {
    for (j=1; j<=4;j++)
      {
        DGStats.CurrentCell = new DataGridCell(j, i);
        DGStats.Text = string.Empty;
      }
  }

in vb6 this approach used to work: setting row and column, and then setting the text property. but in .NET i'm kinda lost.

such a simple task ...

thanks for any insight you ay have,

G.
 
gl3nt0n:

You need to manipulate the DataSource that the DataGrid is bound to.....for example, if the DataGrid is bound to a DataTable, loop through the DataRows in the table and set the DataColumn values you would like to clear to "".
 
I believe you can do it directly by

DGStats(j,i) = string.Empty;

but you may have to force the binding afterwards
 
Back
Top