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 throught form2 array base on the number of guest but then i got this error. NullReferenceException was unhandled
how to solve this...i underline under my 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).ShowDialog()
Loop

End Sub

Recommended Answers

All 5 Replies

The counter has to be reached AND the bIsNExtClicked has to be true?

Should that be "OR"?

Oh yeah! Actually, What i want is to base on the number of guest and ask the user to enter each guest information which is in form 2...so what i should do now...i am stucking. the problem basiclly is:
i have two forms.
First form is used to ask from, to, departure time and how many people we want to book for.
Second form is used to ask for each person that we book what is their name, age, title, phone number.

i planned to use a loop to loop form 2 to ask for their info. However i woner how we can do this?? can a form be an array to loop??

Yes, you can jump back to the original form if they have additional entries to make.
OR you can just ask at the end of every "submit" if they want to add more entries (if I'm understanding you correctly).

we can not make additional entries sicne the number of guests is unknown...we have to make dynamic content(Create textbox and label at runtime after the the number of guest is known) which is should be stayed in another form for a better handling...haizzz the problem is hard to explain...but it's just a task for newbie of vb.net...are u still there i will give you all my code or the fully task that i am require to do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.