system.thread.sleep
-
im trying to use the system.thread.sleep function to display data in a gridview with a 3 second delay however results are not being displayed. It seems to be a problem with the system =========================================================================================== Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1. Dim ds As DataSet = New DataSet ad.Fill(ds, "tblcustomers") Dim dtab As DataTable = ds.Tables.Add(0) Dim dtabclone As DataTable = dtab.Clone() Dim drow As DataRow = dtab.Rows(0) dtab.Clone.ImportRow(drow) GridView1.DataSource = dtab.Clone GridView1.DataBind() System.Threading.Thread.Sleep(3000) drow = dtab.Rows(1) dtab.Clone.ImportRow(drow) GridView1.DataSource = dtab.Clone GridView1.DataBind()
modified on Monday, January 28, 2008 10:57:23 AM
-
im trying to use the system.thread.sleep function to display data in a gridview with a 3 second delay however results are not being displayed. It seems to be a problem with the system =========================================================================================== Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1. Dim ds As DataSet = New DataSet ad.Fill(ds, "tblcustomers") Dim dtab As DataTable = ds.Tables.Add(0) Dim dtabclone As DataTable = dtab.Clone() Dim drow As DataRow = dtab.Rows(0) dtab.Clone.ImportRow(drow) GridView1.DataSource = dtab.Clone GridView1.DataBind() System.Threading.Thread.Sleep(3000) drow = dtab.Rows(1) dtab.Clone.ImportRow(drow) GridView1.DataSource = dtab.Clone GridView1.DataBind()
modified on Monday, January 28, 2008 10:57:23 AM
solarthur01 wrote:
It seems to be a problem with the system
No. It is a problem with your code. You are adding the rows on the UI thread. You then tell the UI thread to sleep, so while the thread is asleep it cannot do anything. Add the data on a separate thread that you put to sleep so the UI thread has a chance to update itself.
Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * The Value of Smaller Methods * Creating Many-to-Many joins My website | blog
-
solarthur01 wrote:
It seems to be a problem with the system
No. It is a problem with your code. You are adding the rows on the UI thread. You then tell the UI thread to sleep, so while the thread is asleep it cannot do anything. Add the data on a separate thread that you put to sleep so the UI thread has a chance to update itself.
Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * The Value of Smaller Methods * Creating Many-to-Many joins My website | blog
i dont quite understand what i need to do.