I have an assignment that asks me to:

1. create a button
2. when that button is clicked, an inputBox will appear to ask the user how many words they will enter.
3. then display an inputBox for each word.

For example, when the first inputBox appears, I enter "3" (meaning that I will enter 3 words).

Then there should be 3 more inputBox (each inputBox allows me to enter only 1 word)

After I enter the third word, there will be no more inputBox.

How can we FLAG (stop) the inputBox, or let the inputBox know when to stop showing up?

After the first input box, you're going to want to validate that the input is an integer (you can use IsNumeric() or, better yet, Int32.TryParse()) and if it is, then proceed to the next part. If not, repop the original input box. Also check that the integer is greater than 0. This sounds like something that maybe should be in a loop of some sort until the user supplies the right input, agree?

In the next part, consider doing a loop that will execute the number of times specified by the first input box. Perhaps a For loop, i = 1 to usersValue, or maybe you want to try another. Do? While? Inside the body of the loop, pop the input box as directed and do whatever you need to do with data the user provides.

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.