|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
error "object refe..."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 Show quoteHide quote "touf" <tou***@hotmail.com> schreef in bericht news:%23qDbT$3DHHA.4312@TK2MSFTNGP06.phx.gbl... > 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??? > > 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 Show quoteHide quote "touf" <tou***@hotmail.com> wrote in message news:%23qDbT$3DHHA.4312@TK2MSFTNGP06.phx.gbl... > 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??? > >
OO design and programming...
Upgrade Question Q: Regular Expressions? tell more about .net framework Managing without .NET for runtime applications Drag and drop multiple button controls..need help modifying code please??? Adding buttons to form help Embedded Stored Procedure within App array and shell Looking For Training Recommendations |
|||||||||||||||||||||||