-
I have designed a study quide for a test which consists of
65 multiple choice terms and their definitions. I put the terms in a combobox and want the corresponding definition to appear in the textbox as the user selects it.
First, I declared 2 arrays in General Declarations:
Dim Question(100), Answer(100)
Next, under Form_Load
Question(1) = " 1st term "
Question(2) = "2nd term" etc....
Answer(1) = " 1st answer"
Answer(2) = " 2nd answer"
My question is: What code can I use to cause the definition to be entered into the textbox as the user selects it.
Thanks for any help!
-
<?>
Code:
'change the dimensions accordingly
'I am using an array of 2
Option Explicit
Dim Question(1), Answer(1)
Private Sub Combo1_Click()
Dim x
x = Combo1.ListIndex
Text1.Text = Answer(x)
End Sub
Private Sub Form_Load()
Question(0) = " 1st term "
Question(1) = "2nd term"
Answer(0) = " 1st answer"
Answer(1) = " 2nd answer"
Dim i As Integer
For i = 0 To 1
Combo1.AddItem Question(i)
Next i
End Sub
-
Thanks for your prompt reply, I'll try the code!