Jump to content

Thread.sleep


joecool2005

Recommended Posts

If this is for a web application (ASP.NET), then you're not going to be able to because of the way HTTP works. That code you presented would cause the Response to take 10 seconds and then immediately present "testtesttesttesttesttesttesttesttesttest" to the browser's screen.To make this function, you'll have to use javascript on the client side.

<div id="test"></div><script>var i = 0;function writeTest(){	document.getElementById("test").innerHTML += "test";	i++;	if(i < 10)	{		setTimeout("writeTest();", 1000);	}	}writeTest();</script>

Link to comment
Share on other sites

  • 1 month later...

In VB, the code is: System.Threading.Thread.Sleep(1000)

Link to comment
Share on other sites

In VB, the code is: System.Threading.Thread.Sleep(1000)
What he had is also correct if he indluded the system.Threading namespace.You could do this but using javascript and setTimeout would probably be more efficient.
Dim i As Integer		For i = 0 To 10			  Thread.Sleep(1000)			  Response.Write("test")  Response.Flush()			  Session("State") = i + 1		Next		Session("State") = 100

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...