Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loops and Waiting for User input

Status
Not open for further replies.

Dashley

Programmer
Dec 5, 2002
925
US
In the code below Im calling a sub "DisplayQuestion(TheQuestion)" In this sub I have a list of 5 responses (and might have a comment Texbox.)

I can display the TB and selections with a button for when the client is done but I want the code to wait for a user input (the button to be clicked) before going back and hitting the listview for statement.

Thanks


.net 2005 CF
Code:
For Each item In ListView1.Items
     If item.Checked = True Then
        TheQuestion = Me.ListView1.Items(WhichOne).SubItems
        DisplayQuestion(TheQuestion)
Else
   'do somthing else
End If
            Next item
 
Does this code:

DisplayQuestion(TheQuestion)

open a form or something?



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
jebenson,

No. It sets the existing form up for a question(textbox and Button).

 
the following assumes this is forms, i know nothing about asp...

so, you have a listbox, a label, a textbox and a button.

the code should loop through the items in the listbox, setting the text on the label to the question, accepting the answer in the textbox and allowing the user to signal when they've answered this question.

an explicit for loop, IMNSHO, is not the way to do this.

let windows, and the user, control when the next question is answered.

have three buttons, next, previous and OK. write the answer for the last question and set the text on the label for the current question in the listbox_SelectionChanged event.

clicking the next button advances the selection of the listbox one, and prev does the opposite.

this way you get the code that does stuff in only one place, too.

hope this helps,


mr s. <;)

 
Thanks misterstick. It was forms.

The loop was through a listbox item collection after the fact. The user clicked on or more checboxes and the hit a button. Then the loop started.

I added another form to thet project and the loop is now working by brining up the form for each checkbox cheked.


DASHLEY
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top