Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. system.thread.sleep

system.thread.sleep

Scheduled Pinned Locked Moved Visual Basic
help
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    solarthur01
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • S solarthur01

      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

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      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

      S 1 Reply Last reply
      0
      • C Colin Angus Mackay

        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

        S Offline
        S Offline
        solarthur01
        wrote on last edited by
        #3

        i dont quite understand what i need to do.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups