Connecting Tech Pros Worldwide Help | Site Map

problem with defaultview

Toufik
Guest
 
Posts: n/a
#1: Mar 7 '06
Hi,
I've a strange problem, when I execute the code below I've the error
"An unhandled exception of type 'System.NullReferenceException' occurred in
system.data.dll
Additional information: Object reference not set to an instance of an
object."

Ive the error with the second row,
the line: dsfrm.Tables("tablename").DefaultView(k).Item("pri x") = 0, can be
executed without error,
but after it the datarow
dsfrm.Tables("tablename").DefaultView(k).Item("tax e") gives me the erroor
NULLREFERENCE EXCEPTION and the item "prix" gives me the same error.

It looks like if the error appears after x changes made on
"dsfrm.Tables("tablename").DefaultView"

Here is the code.
dsfrm.Tables("tablename").DefaultView.RowFilter = True

For k = 0 To dsfrm.Tables("tablename").DefaultView.Count - 1

dsfrm.Tables("tablename").DefaultView(k).Item("pri x") = 0

dsfrm.Tables("tablename").DefaultView(k).Item("tax e") = 0

Next


Closed Thread