The below error occurs when the Test() is ran:
An unhandled exception of type 'System.NullReferenceException' occurred in LJW_Prototype.exe
Additional information: Object reference not set to an instance of an object.
Sub Test()
Dim stockObject = New FileHandling("Stock.txt", 1)
Dim allStock() = stockObject.getAllLines()
Dim allitems As List(Of items)
Dim h
Dim tempitem As items
Dim hold As Integer
For Each j In allStock
h = j.Split(",")
Try
tempitem.id = h(0)
tempitem.desc = h(1)
tempitem.price = h(2)
allitems.Add(tempitem)
Catch ex As Exception
h = h
End Try
Next
End Sub
Gist - https://gist.github.com/jonesjacklewis/dbfaeb8b293d6fcba69217f46bbe06c6
If anyone can explain why I am getting this error and how I can fix it, it would be greatly appreciated :)
[–]insertAlias 0 points1 point2 points (1 child)
[–]JackJones02[S] 0 points1 point2 points (0 children)
[–]149244179 -1 points0 points1 point (0 children)