Search Results

Search found 1 results on 1 pages for 'glenn05'.

Page 1/1 | 1 

  • Nullable object must have a value. VB.NET

    - by Glenn05
    I need help. I'm having problem in my program. This is my code on my Business logic layer. Function Load_ItemDetails(ByVal ItemID As String) As Items Dim objItemEnt As New tblitem Dim objitem As New Items Try Using da = New DataAccess objItemEnt = da.Load_ItemDetails(ItemID) With objitem .ItemCode = objItemEnt.ItemCode .ItemName = objItemEnt.ItemName .Description = objItemEnt.Description .NameofType = objItemEnt.NameofType .TypeofPricing = objItemEnt.TypeofPricing .OnStock = objItemEnt.OnStock .ItemPrice = objItemEnt.ItemPrice .DateModified = objItemEnt.DateModified End With Return objitem End Using Catch ex As Exception Throw End Try End Function This code is for my data access layer. Public Function Load_ItemDetails(ByVal ItemCode As String) Dim objitem As New tblitem Try Using entItem = New DAL.systemdbEntities1 Dim qryUsers = From p In entItem.tblitems Where p.ItemCode = ItemCode Select p Dim luser As List(Of tblitem) = qryUsers.ToList If luser.Count > 0 Then Return luser.First Else Return objitem End If End Using Catch ex As Exception Throw End Try End Function` For my Presentation layer: Private Sub Load_Item_Detail(ByVal ItemCode As String) objItem = New Items Using objLogic = New LogicalLayer objItem = objLogic.Load_ItemDetails(ItemCode) With objItem Me.ItemCodetxt.Text = .ItemCode Me.ItemNametxt.Text = .ItemName Me.ItemDesctxt.Text = .Description Me.ItemTypetxt.Text = .NameofType Me.ItemPricetxt.Text = .TypeofPricing Me.ItemOnstocktxt.Text = CStr(.OnStock) Me.ItemPricetxt.Text = CStr(.ItemPrice) Me.TextBox1.Text = CStr(.DateModified) Me.ItemCodetxt.Tag = .ItemCode End With End Using End Sub` and after I run, I get this error Nullable object must have a value help me. I'm stuck. I don't know what to do guys. I new in n tier architecture.

    Read the article

1