I am taking a entry level course in VB6 and all examples of do loops show how to display numbers one at a time but I can't figure out how to display a string one at a time in a txtbox. using cmdNext. I have many more questions but will start slow. Thanks
I'm not sure what you're asking... what exactly do you mean by display a string one at a time on a txtbox?
You mean displaying one string and after you press a button display another one? Is that it?
If it's this it's way too simple just make txtbox.text="your string" each time you press the button...
I suppose you wanted something else, but you weren't very explicit on your post.
Thank you for responding. I was very vague. It is a project for class and it requires that I display a question(proverbs) one at a time. There are seven. Have the user select true or false. Then calculate the number of correct answers and display a message accordingly. I am not sure how to get them to display one at a time. Here is the code I have written so far:
Private Sub cmdNext_Click()
Dim QuesNum%, Question$, CorrectNum%, Message$
' display seven true or false proverbs one at a time
' calculate the number of correct answers and the display correct numbers with a text messages.
For QuesNum% = 1 To 7
Select Case QuesNum%
Case Is = 1
Question$ = "1. The squeaky wheel gets the grease."
Case Is = 2
Question$ = "2. Cry and you cry alone."
Case Is = 3
Question$ = "3. Opposites attract."
Case Is = 4
Question$ = "4. Spare the rod and spoil the child."
Case Is = 5
Question$ = "5. Actions speak louder than words."
Case Is = 6
Question$ = "6. Familiarity breeds contempt."
Case Is = 7
Question$ = "7. Marry in haste, repent at liesure."
End Select
Next
Correct me if I'm wrong, but this is pretty easy.
You want to display the questions in a text box right? First you show one then you show the next one and so on?
I would suggest you don't use a for cycle for this, instead you could use a variable that would increase each time the user gives you an answer and an array with all the questions, and then you would post the the next question on a text box.
Let's say you have a cmdbutton for yes and other for no. Each time the user presses one of them you increase the variable and then according to it's number you would post the correspondent question on a txtbox.
txtbox.text = array(i)
Of course u could also use the for cycle and force the code to wait for the user to press the button before it goes to the next question, but I think this way is easier.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.