A
André Fereau
Hi,
I wish to use a class derivated from DataRow. The rows within a table are
created with the NewRow method of the DataTable class. So I writed a method
NewSTMTTRNRow() in my class STMTTRNDataTable, but I have an Invalid Cast
Exception in the code "return
((STMTTRNRow)(this.NewRow()));". Where is the bug? What is the smart way to
achieve my goal?
Code :
public class STMTTRNDataTable : DataTable, System.Collections.IEnumerable
{
public STMTTRNRow NewSTMTTRNRow()
{
return ((STMTTRNRow)(this.NewRow()));
}
public System.Collections.IEnumerator GetEnumerator()
{
return this.Rows.GetEnumerator();
}
}
public class STMTTRNRow : System.Data.DataRow
{
private STMTTRNDataTable tableSTMTTRN;
internal STMTTRNRow(DataRowBuilder rb) : base(rb)
{
this.tableSTMTTRN = ((STMTTRNDataTable)(this.Table));
}
}
Ragards,
AFer92
I wish to use a class derivated from DataRow. The rows within a table are
created with the NewRow method of the DataTable class. So I writed a method
NewSTMTTRNRow() in my class STMTTRNDataTable, but I have an Invalid Cast
Exception in the code "return
((STMTTRNRow)(this.NewRow()));". Where is the bug? What is the smart way to
achieve my goal?
Code :
public class STMTTRNDataTable : DataTable, System.Collections.IEnumerable
{
public STMTTRNRow NewSTMTTRNRow()
{
return ((STMTTRNRow)(this.NewRow()));
}
public System.Collections.IEnumerator GetEnumerator()
{
return this.Rows.GetEnumerator();
}
}
public class STMTTRNRow : System.Data.DataRow
{
private STMTTRNDataTable tableSTMTTRN;
internal STMTTRNRow(DataRowBuilder rb) : base(rb)
{
this.tableSTMTTRN = ((STMTTRNDataTable)(this.Table));
}
}
Ragards,
AFer92