error "object refe..."

  • Thread starter Thread starter touf
  • Start date Start date
T

touf

Hi,
I've the "object reference not set to an instance of an abject" error in the
folowing code (initialise a datatable's rows to 0)
this is hapening for the 2nd field (taxe) of the 2nd row (the first is ok!!)

DSFrm.Tables("test").DefaultView.RowFilter = True

For k = 0 To DSFrm.Tables("test").DefaultView.Count - 1

DSFrm.Tables("test").DefaultView(k).Item("price") = 0

DSFrm.Tables("test").DefaultView(k).Item("taxe") = 0

Next



Any help please???
 
touf,

Often this kind of trouble happens when the field description ("taxe") is
not in the right case.

Cor
 
I suspect, for starters, you need to get rid of the
"DSFrm.Tables("test").DefaultView.RowFilter = True" line. I don't know what
you intended, but the default for a RowFilter is all rows.

Also, why use the DefaultView at all? It just passes the changes to the
datatable anyway...

In VB, instead of FORTRAN (pseudo code if it doesn't work ;) :

For row as DataRow in DSFrm.Tables("test").Rows
row.Item("price") = 0
row.Item("taxe") = 0
Next row

HTH,
Prester John
 
Back
Top