|
-
Oct 9th, 2017, 11:01 AM
#1
Thread Starter
PowerPoster
[RESOLVED] Cutting off part of a label caption for a multiple choice question game.
Hi there folks! I am working on another review game for my class! They loved the first one!
What I am doing this time, is I am typing a series of questions with 4 possible choices(sort of like who wants to be a millionaire kind of thing)
The questions look like this in the textfile
How many provinces are there in Canada? 5, 10, 13, 15 *10
The *10 in this case would be the correct answer. The program picks a random question, and puts the line in a label caption called PickLBL. I would like to separate the 4 possible choices for answers and put them in a label array called ChoiceLBL(0)-(3). All questions will have 4 choices. The one with the *before it is the correct answer and I would like to cut off that and put it into the RightANS.caption, so when the student picks their choice, the program will compare their choice to the right answer to see if it is the correct answer.
What I have done so far is used MID$ to cut off the question itself
VB Code:
Public Sub GetQuestionFromLabel()
Dim intPos As Integer
Dim strQ As String
intPos = InStr(PickLBL.Caption, "?") ' Locate the position of the "?" in PickLBL.Caption
strQ = Mid$(PickLBL.Caption, 1, intPos - 1) ' Copy up to but not including the "?" sign to strQ
QuestionLBL.Caption = strQ & "?"
End Sub
Now that I have the question I am stuck on how to cut of the multiple label captions because they are separated by commas. I can use RIGHT$ (I think) to cut off one of those answers with a comma, but would it work with 4 commas separating possible choices?
Your expertise in this project is greatly appreciated as always!
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|