helo all i'm quite new to vb.net i'm trying to use the online help suggestion that's supposed to load a specific table row into a variable: Dim Lnrow As paraohDataSet.LoansRow Lnrow = ParaohDataSet.Loans.FindBylID(5) trying to use it to reach any value, like using this line: LID.Text = Lnrow.lID causes an error : "Object reference not set to an instance of an object." since that's exactly as it is in help, i cant find where i do wrong please help thanx Erez.
"Erez Mor" wrote in message news:C05A493A-A477-41D4-83CA-15E17887A5D1@microsoft.com... > helo all > i'm quite new to vb.net > i'm trying to use the online help suggestion that's supposed to load a > specific table row into a variable: > > Dim Lnrow As paraohDataSet.LoansRow > Lnrow = ParaohDataSet.Loans.FindBylID(5) > > trying to use it to reach any value, like using this line: > LID.Text = Lnrow.lID > > causes an error : "Object reference not set to an instance of an object." > I see two possible solutions: one is that you'll get the error if you don't instantiate the datarow with 'New' like this: Dim Lnrow As New paroahDataSet.LoansRow But if you're getting a datarow from FindByID you shouldn't need to do that - you'll get a reference to the row in the table *unless* there is no row found, in which case you have no object which takes us back to square one. My suggestion would be to check to be sure that you get a row from FindByID before going any further: If Not IsNothing(Lnrow) Then LID.Text = Lnrow.1ID Else 'Handle row not found error here End If hth; DCraig.