First new row editing Error in DataGrid

Apr 19, 2011 at 3:43 AM
Edited Apr 19, 2011 at 3:44 AM

DGripIpGrp is DataGrid

DGridIPGrp.Columns.Add("NM_IPGRP", "LOC", typeof(string));
DGridIPGrp.Columns.Add("NM_IPADDR", "BOUND", typeof(string));
...
DGridIPGrp.Selection.EnableMultiSelection = true;
...
DGripIpGrp.DataSource = new DevAge.ComponentModel.BoundDataView(dtTable.DefaultView);

(dtTable was receved table from MS SQL that empty table(not yet insert any data)

and begin editing on form ERROR
...

  public virtual object GetItemValue(int index, System.ComponentModel.PropertyDescriptor property)
  {
   object dataVal = property.GetValue(m_dataView[index]);     // error line

   //Convert DbNull to null
   if (System.DBNull.Value == dataVal)
    return null;
   else
    return dataVal;
  }

property is null

  public object GetValue(CellContext cellContext)
  {
   DataGrid grid = (DataGrid)cellContext.Grid;

   PropertyDescriptor prop = grid.Columns[cellContext.Position.Column].PropertyColumn;

   int dataIndex = grid.Rows.IndexToDataSourceIndex(cellContext.Position.Row);

   //Check if the row is not outside the valid range (for example to handle the new row)
   if (dataIndex >= grid.DataSource.Count)
    return null;
   else
    return grid.DataSource.GetItemValue(dataIndex, prop);
  }

prop is null

I can not speak english well. ^^;