I'm doing a quiz program. And dont wanna use to much forms, so how can i make the capacity of the listbox change after someone chose the good anwser. Thanx
Ps: code sample would be nice
Thanx,
Printable View
I'm doing a quiz program. And dont wanna use to much forms, so how can i make the capacity of the listbox change after someone chose the good anwser. Thanx
Ps: code sample would be nice
Thanx,
What do you mean by "change"?
Do you want to clear out all entries except the correct answer?
Changing the height will change the no. of entries you can see at once.
To clear all the items except the right answer.
[Highlight=VB]
dim s as string
dim i as integer
s = "Correct Answer"
for i = 0 to list1.listcount-1
if ucase(list1.list(i)) <> ucase(s) then
list1.removeitem(i)
end if
next i
These are both things that I thought of, but I wasn't, and still am not, sure exactly what the question is.
Look an example:
1) what is 5+2
3
4
7
If list1.text = "7" then
label1.caption = " 2) what is 7-8" 'thats the next qeustion'
Now my qeustion is, is there a code to change the answers in the listbox, the same what I did whit the qeustion in label1.
VB Code:
Option Explicit Private Sub Command1_Click() If List1.List(List1.ListIndex) = "3" Then Label1.Caption = "2) What is 2 + 2" List1.Clear List1.AddItem "5" List1.AddItem "8" List1.AddItem "4" Else Exit Sub End If End Sub Private Sub Form_Load() Label1.Caption = "1) What is 1 + 2" List1.AddItem "1" List1.AddItem "5" List1.AddItem "3" End Sub
That looks good i'll make a prog like that myself when i'm bored. ;)