-4
Dim id As Integer
Dim tempIdList As List(Of Integer)  

If dr.Read() Then
      Do
         Dim loc As String
         loc = dr("CurrentLocation").ToString()
         id = dr("ID")
         'tempIdList.Add(dr("ID"))
         'tempIdList.Add(id)
             If loc = comboFrom.Text Then
                  isContinue = True
             End If
      Loop While dr.Read
End If

I have tried those commented code. But I get Object reference not set to an instance of an object.
I tried adding a break point, and it seemed that the list does not get a value, just Nothing whilst id has the value of the ID from the access database.

What is wrong?

AdorableVB
  • 1,383
  • 1
  • 13
  • 44
  • 1
    possible duplicate of [What is a NullReferenceException and how do I fix it?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – sloth Mar 26 '14 at 10:11

1 Answers1

2

tempIdList is probably Nothing. You have to create an instance first with the New keyword:

Dim tempIdList As List(Of Integer) = New List(Of Integer)  
sloth
  • 99,095
  • 21
  • 171
  • 219