Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42220

[RESOLVED] iList troubles

$
0
0
I have a class (GuestList) and I want to create a list of guests using iList.

I'm looping through results in my SQL server search and want to add each guest to my list but I get the below error.

What is wrong?

vb.net Code:
  1. Dim GuestList As IList(Of GuestClass)
  2.  
  3.  
  4. 'Via a SQL SERVER DATAREADER LOOP RESULT
  5. Dim FoundGuest As New GuestClass
  6. FoundGuest.GuestID = reader(0)
  7. FoundGuest.GuestFirstName = reader(2)
  8. FoundGuest.GuestLastName = reader(3)
  9.  
  10. GuestList.Add(FoundGuest)

Code:

System.NullReferenceException: Object reference not set to an instance of an object.
  at WindowsApplication1.GuestSearch.Button2_Click(Object sender, EventArgs e) in C:\Users\PC1\Desktop\Projec1\GuestSearch.vb:line 28


Viewing all articles
Browse latest Browse all 42220

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>