Hi Every one ,
on monday i have to submit my assignment i need ur help in this regard

make a label box in vb

one label box

and only one

and one text button

okay

so, when the user clicks on the next button

a question should display in that label box

he/she click again, the second question displays

so on..

15 questions should display

my teacher she showed some thing like this but that doesnt work .

Private Sub cmdNext_Click()
Dim intQuestion As Integer
Dim intQ1 As Integer
Dim intQ2 As Integer

intQuestion = intQuestion + 1

If intQuestion = intQ1 Then
lblQuestion.Caption = "Which country has the most people?"
ElseIf intQuestion = intQ2 Then
lblQuestion.Caption = "What is the biggest, ocean or a lake?"
End If

End Sub

can any one tell me how to do so ? i will be thank full to him / her
waiting

Recommended Answers

All 3 Replies

ok here a tip


Dim intQ1 As Integer
Dim intQ2 As Integer

those to must have a value
declare it on your next button


on your form_load event put this


intQ1 = 1
intQ2 = 2
intQ3 = 3
(and so )
private_Sub cmdNext_click()


if intQuestion=1 then
lblQuestion.Caption = "Which country has the most people?"
ElseIf intQuestion = intQ2 Then
lblQuestion.Caption = "What is the biggest, ocean or a lake?"
(and so on)


(lastly)
intQuestion = intQuestion + 1
end if
end sub

this may solve your prob, but its only kinda basic there more better code than this 1

pm me when it help you


cheers GL

sorry that didnt work :(
can you give me another code and explain it a bit i will be thank full to u

form_load ()

dim SCOREBASKET 'making a dim containing the value 


if SCOREBASKET = 1 then
lblQuestion.caption = "XXXXXX" 'where XXXXXX is up to you

end if

if SCOREBASKET = 2 then
lblQuestion.caption = "OOOOO" 'where OOOOO is up to you

end if

if SCOREBASKET = 3 then
lblQuestion.caption = " ZZZZZ" 'where ZZZZ is up to you
end if

end sub

========================

private_sub cmdNext_click () 'its your next button

SCOREBASKET = SCOREBASKET + 1   '<----once succeded on the question statement add a +1 value to SCOREBASKET 

call form_load  '<----- this loads up again all the code on formload BUT since you add a +1 to the SCOREBASKET it will load the 2nd question since SCOREBASKET's value is no 2

end sub

wish you get the idea,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.