|
-
Sep 24th, 2001, 07:47 AM
#1
Thread Starter
New Member
How can I change the capacity of a listbox?????
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,
-
Sep 24th, 2001, 08:04 AM
#2
What do you mean by "change"?
Do you want to clear out all entries except the correct answer?
-
Sep 24th, 2001, 08:38 AM
#3
Addicted Member
Changing the height will change the no. of entries you can see at once.
-
Sep 24th, 2001, 08:57 AM
#4
Frenzied Member
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
-
Sep 24th, 2001, 09:47 AM
#5
These are both things that I thought of, but I wasn't, and still am not, sure exactly what the question is.
-
Sep 24th, 2001, 11:23 AM
#6
Thread Starter
New Member
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.
-
Sep 24th, 2001, 11:30 AM
#7
Frenzied Member
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
-
Sep 24th, 2001, 11:36 AM
#8
Addicted Member
That looks good i'll make a prog like that myself when i'm bored.
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
|