NullReferenceException was unhandle when loop an object

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • huskar
    New Member
    • Mar 2012
    • 6

    NullReferenceException was unhandle when loop an object

    Hi Everyone!
    I got two form.
    form 1 i ask the user a number of guest
    form 2 i ask each guest their name, their age
    i decide to make a loop base on the number of guest but then i got this error. NullReferenceEx ception was unhandled
    how to solve this...i underline under my code

    Code:
    Private Sub btnBook_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBook.Click
    
            iTest = CInt(txtChildren.Text)
            Do Until (iCounter = iTest) And (bIsNextClicked = True)
                PassengersDetails(iCounter).[U]ShowDialog()[/U]
            Loop
    
        End Sub
    Last edited by PsychoCoder; Mar 17 '12, 06:45 PM. Reason: Code tags added
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    I would start with putting a break point on line 4 to see what value ICounter holds.

    Comment

    Working...