Link


CREATION OF TIMER AS ACTIVEX COMPONENT AND USE IT IN QUIZ APPLICATION

Timer

******

· File ->new ->activexcontrol.Minimise the from to a convenient level

· Place a textbox and a Timer. Set the Interval for timer in the properties window(set interval to 1000).Clear the text field in the properties of the text box

· Double click timer and type the following code

Private Sub Timer2_Timer()

If Val(Text1.Text) > 0 Then

Text1.Text = Text1.Text - 1

If Val(Text1.Text) = 0 Then

MsgBox "TIME OVER:"

End If

End If

End Sub

· Double click the empty space in the form and type the following code

Private Sub UserControl_Initialize()

Text1.Text = 30

End Sub

· Save the project and choose File->Project1.ocx(if the project name is Project1) choose a path to save the .ocx file

· Close the from and coding window

Quiz Form

**********

· Choose File->add project->ok

· Design the quiz form with a label,4 option buttons and 3 command buttons.(change their names to Next,Score,Quit in the properties window

· Go to Project->Components->browse->choose the .ocx file you ve created. click ok.An icon will appear near the OLE icon in the toolbox drag and drop it in the form

· Click on the empty space in the form and type the following

Option Explicit

Dim q(5) As String

Dim a(20) As String

Dim sc As Integer

Dim c As Integer

Private Sub Form_Load()

c = 1

sc = 0

q(1) = "1.ABBREVIATION FOR SSI"

q(2) = "2.SERVER SIDE API ARE CALLED AS "

q(3) = "3._______ IS USED TO WRITE SERVLETS"

q(4) = "4.ABBREVIATION FOR RMI"

q(5) = "5.THE DEFAULTS PORT FOR HTTP IS"

a(1) = "SERVER SIDE INCLUDE"

a(2) = "SMALL SCALE INDUSTRIES"

a(3) = "SERVER SOLUTION INTEGRATED"

a(4) = "SERVER SLOT INPAGE"

a(5) = "JARS"

a(6) = "SERVLETS"

a(7) = "PORTS"

a(8) = "API"

a(9) = "WEB SERVER"

a(10) = "JAVA SOFT"

a(11) = "JDSK"

a(12) = "JDK"

a(13) = "READ MEMORY INTRINSIC"

a(14) = "REMOTE MEMORY INTERFACE"

a(15) = "REMOTE METHOD INTERFACE"

a(16) = "REMOTE METHOD INVOCATION"

a(17) = "WEB SERVER"

a(18) = "JAVA SOFT"

a(19) = "JDSK"

a(20) = "JDK"

Label1.Caption = q(1)

Option1.Caption = a(1)

Option2.Caption = a(2)

Option3.Caption = a(3)

Option4.Caption = a(4)

End Sub

· Coding for Next

Private Sub Next_Click()

c = c + 1

Select Case c

Case 2

If Option1.Value = True Then

sc = sc + 1

End If

Label1.Caption = q(c)

Option1.Caption = a(5)

Option2.Caption = a(6)

Option3.Caption = a(7)

Option4.Caption = a(8)

Case 3

If Option2.Value = True Then

sc = sc + 1

End If

Label1.Caption = q(c)

Option1.Caption = a(9)

Option2.Caption = a(10)

Option3.Caption = a(11)

Option4.Caption = a(12)

Case 4

If Option3.Value = True Then

sc = sc + 1

End If

Label1.Caption = q(c)

Option1.Caption = a(13)

Option2.Caption = a(14)

Option3.Caption = a(15)

Option4.Caption = a(16)

Case 5

If Option4.Value = True Then

sc = sc + 1

End If

Label1.Caption = q(c)

Option1.Caption = a(17)

Option2.Caption = a(18)

Option3.Caption = a(19)

Option4.Caption = a(20)

Case 6

If Option1.Value = True Then

sc = sc + 1

End If

MsgBox "QUIZ COMPLETED"

Score.Visible = True

End Select

End Sub

· Coding for Quit

Private Sub Quit_Click()

End

End Sub

· Coding for Score

Private Sub Score_Click()

MsgBox "SCORE:" & sc

End Sub

FORM DESIGN:

TIMER

QUIZ FORM

OUTPUT

TIMER

QUIZ FORM

Comments