![]() |
|
|
|
#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 |
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Delay in Toshiba HD Player | Alpha | DVD Video | 2 | 02-12-2006 10:27 PM |
| Toshiba to delay HD DVD player launch | Allan | DVD Video | 12 | 12-27-2005 03:45 PM |
| Toshiba hints at HD DVD launch delay. | Allan | DVD Video | 3 | 09-02-2005 03:32 AM |
| Bush administration will delay major assaults until after U.S. elections | jasmine | DVD Video | 9 | 10-14-2004 12:30 AM |
| Disney Treasures 3 Delay: Tin Can Alley. | Scot Gardner | DVD Video | 0 | 11-16-2003 11:56 PM |