actually its a little big and there are many forms for this quiz system i'm making ... i'll just paste the whole code for the form that need timer.....
Public Class web
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
Dim ds As New DataSet
Dim ds1 As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim Sql As String
Dim MaxRows As Integer
Dim inc As Integer
Dim t As Integer = 10
Private Sub vbnet_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Label3.Text = main.TextBox1.Text
Label7.Text = main.TextBox2.Text
TextBox1.Enabled = False
TextBox2.Enabled = False
TextBox3.Enabled = False
Button3.Enabled = False
Button2.Enabled = False
main.Hide()
con.ConnectionString = db
con.Open()
Sql = "SELECT * FROM web"
da = New OleDb.OleDbDataAdapter(Sql, con)
da.Fill(ds, "question1")
con.Close()
inc = 0
NavigateRecords()
Label6.Text = ds.Tables("question1").Rows(inc).Item(1)
TextBox1.Text = ds.Tables("question1").Rows(inc).Item(2)
TextBox2.Text = ds.Tables("question1").Rows(inc).Item(3)
TextBox3.Text = ds.Tables("question1").Rows(inc).Item(4)
MaxRows = ds.Tables("question1").Rows.Count
inc = -1
End Sub
Private Sub NavigateRecords()
Label6.Text = ds.Tables("question1").Rows(inc).Item(1)
TextBox1.Text = ds.Tables("question1").Rows(inc).Item(2)
TextBox2.Text = ds.Tables("question1").Rows(inc).Item(3)
TextBox3.Text = ds.Tables("question1").Rows(inc).Item(4)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If inc <> MaxRows - 1 Then
inc = inc + 1
TextBox4.Text = ""
NavigateRecords()
Else
MsgBox("No More Rows")
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If inc > 0 Then
inc = inc - 1
NavigateRecords()
Else
MsgBox("First Record")
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If inc <> MaxRows - 1 Then
inc = MaxRows - 1
NavigateRecords()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If inc <> 0 Then
inc = 0
NavigateRecords()
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If (t > 0) Then
Label8.Text = t & " secs left"
t = t - 1
Else
Timer1.Enabled = False
MsgBox("Time up")
inc = inc + 1
NavigateRecords()
End If
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
End
End Sub
Private Sub AddToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddToolStripMenuItem.Click
web_aud.Show()
Me.Hide()
web_aud.Button2.Enabled = False
web_aud.Button3.Enabled = False
web_aud.Button1.Enabled = True
web_aud.Button4.Enabled = True
End Sub
Private Sub UpdateToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdateToolStripMenuItem.Click
web_aud.Show()
Me.Hide()
web_aud.Button1.Enabled = False
web_aud.Button4.Enabled = False
web_aud.Button3.Enabled = False
web_aud.Button2.Enabled = True
End Sub
Private Sub DeleteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteToolStripMenuItem.Click
web_aud.Show()
Me.Hide()
web_aud.Button1.Enabled = False
web_aud.Button4.Enabled = False
web_aud.Button2.Enabled = False
web_aud.Button3.Enabled = True
End Sub
Private Sub MenuStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles MenuStrip1.ItemClicked
Timer1.Enabled = False
End Sub
End Class