loop according to the delay

Discussion in 'Software' started by kavidream24, Dec 23, 2008.

  1. kavidream24

    kavidream24

    Joined:
    Dec 23, 2008
    Messages:
    1
    hello

    i have problem in looping according to the delay....the delay is coming from the ms access...the delay is 1s ,2s ,3s ,4s ,5s, 6 ....i attached my coding to this...i do this webpage in asp.net...plese help in this.....button_1 is start the looping....... btnstop is to stop the looping...Timer_1 is ajax uset to refresh automatically...for each row in the datagrid have delay..it must loop the datagrid according to that delay...thank u so much...i need this help...please

    Imports System.Data.OleDb
    Imports System.Data

    Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim Conn As OleDbConnection
    Dim da As OleDbDataAdapter
    Dim sConn As String
    Dim sComm As String
    Dim ds As New DataSet

    'ViewState("i") = 0

    'Build the connection string
    sConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
    sConn += " Data Source=C:/kavitha1.mdb;"
    'sConn += "Data Source=C:\Inetpub\wwwroot\kavitha1.mdb;"
    sConn += "Persist Security Info=False"

    'Build the SQL string sComm = "SELECT Products.ProductID, "

    sComm = "SELECT class,command,parameter,return,delay FROM Table2"

    'Usually you would use error-handling here. It is left out to
    'make the code as simple as possible.

    'Create the connection and command objects
    Conn = New OleDbConnection(sConn)
    da = New OleDbDataAdapter(sComm, Conn)

    'Fill the dataset with the results of the query
    da.Fill(ds, "Table2")

    'Set the grid source to the dataset and bind the data
    ''GridView1.DataSource = ds.Tables("Table1").DefaultView
    ''GridView1.DataBind()

    GridView1.DataSource = ds.Tables(0)
    GridView1.DataBind()

    count = ds.Tables(0).Rows.Count


    End Sub
    Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Init
    ViewState("i") = 0
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    'Dim d As Integer
    'For d = 0 To 4
    ' Response.Write("In the For Loop")
    'Next d
    'Dim f As Integer


    'Response.Write("The Loop ran " & f & "times")

    'For i = 5 To 16

    ' Response.Write("You are " & i + 1 & ".")
    ' Response.Write("Go to school.<br>")
    'Next
    'Response.Write("School's out!")

    'Dim p As Integer
    'p = 0
    'While p <= 5
    ' p = p + 1
    ' Response.Write(p)
    'End While
    'Return

    Timer1.Interval = 1000 '1000 = 1 second
    Timer1.Enabled = True
    End Sub


    Dim count As Integer = 0
    Dim index As Integer = 0
    Dim delay As Integer = 0
    Dim looping As Integer


    Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick

    index = CInt(ViewState("i").ToString()) Mod count
    GridView1.Rows(index).BackColor = Drawing.Color.GreenYellow
    GridView1.Rows(index).Font.Bold = True
    If (index = 0) Then

    GridView1.Rows(count - 1).BackColor = Drawing.Color.White
    GridView1.Rows(count - 1).Font.Bold = False
    Else
    GridView1.Rows(index - 1).BackColor = Drawing.Color.White
    GridView1.Rows(index - 1).Font.Bold = False
    End If
    ViewState("i") = CInt(ViewState("i")) + 1
    txtLoop.Text = CInt(ViewState("i"))


    End Sub


    Protected Sub btnStop_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnStop.Click

    Timer1.Enabled = False
    'Let the highlighten row stay highlighten

    index = (CInt(ViewState("i").ToString()) - 1) Mod count
    GridView1.Rows(index).BackColor = Drawing.Color.Red
    GridView1.Rows(index).Font.Bold = True
    End Sub
    End Class
    kavidream24, Dec 23, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Scanner2001
    Replies:
    1
    Views:
    375
    Kevin
    Jul 21, 2004
  2. Kat
    Replies:
    223
    Views:
    3,327
  3. Allan
    Replies:
    0
    Views:
    586
    Allan
    Mar 23, 2005
  4. Silverstrand

    Windows Vista to be delayed again, according to MS

    Silverstrand, May 17, 2006, in forum: Front Page News
    Replies:
    0
    Views:
    592
    Silverstrand
    May 17, 2006
  5. Stone
    Replies:
    1
    Views:
    15,625
    stephen
    Sep 27, 2006
Loading...

Share This Page