473,770 Members | 1,994 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using delay in vb.net

hi friends,
I want to know how can we insert delay in vb.net
like.....
i want to show two strings on same label
first one string then break of 5 secs and then second string
how can i acheive this?
i mean label should show first
label.text("bef ore")
then it should wait for 5 secs and then it should show
label.text("Aft er")

thanks
Amit
Nov 20 '05 #1
10 93995
"AmitTrehan " <am************ @hotmail.com> schrieb
hi friends,
I want to know how can we insert delay in vb.net
like.....
i want to show two strings on same label
first one string then break of 5 secs and then second string
how can i acheive this?
i mean label should show first
label.text("bef ore")
then it should wait for 5 secs and then it should show
label.text("Aft er")


label.text = "before"
system.threadin g.thread.sleep( 5000)
label.text = "after"

Note that the app is locked during the 5 sec. If you don't want this, you
can use a Timer (see System.Windows. Forms.Timer) instead. After setting the
label the first time, enable the timer (interval = 5000). In the Timer's
Tick event, disable the timer and set the label text again.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
Cor
Hi Amit,

Have a look at timer,
there are 3 can use the most simple for this the forms.form.time r

Although if you do not mind that your form freze you can also do
Roughly written here in this message
\\\
dim a as string() = {"Before","Midd le","After"}
for i as integer = 0 to a.lenght - 1
label1.text = a(i)
threading.threa d.sleep(5000)
next
///
I hope this helps

Cor

I want to know how can we insert delay in vb.net
like.....
i want to show two strings on same label
first one string then break of 5 secs and then second string
how can i acheive this?
i mean label should show first
label.text("bef ore")
then it should wait for 5 secs and then it should show
label.text("Aft er")

Nov 20 '05 #3
Cor
Hi Armin,

I think I get comments from Armin with my solution,

"Why not using a timer?

are you making the same

:-)

Cor
Nov 20 '05 #4
* "Cor" <no*@non.com> scripsit:
Have a look at timer,
there are 3 can use the most simple for this the forms.form.time r

Although if you do not mind that your form freze you can also do
Roughly written here in this message


You can make a loop looping from 1 to 5 and let the thread sleep for 1
second, then call 'Application.Do Events'. Quick and dirty, I know.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #5
Cor
Hi Herfried,

That is my own solution in past often told not to be good by you

:-) again the whole day gone?

Cor
Have a look at timer,
there are 3 can use the most simple for this the forms.form.time r

Although if you do not mind that your form freze you can also do
Roughly written here in this message


You can make a loop looping from 1 to 5 and let the thread sleep for 1
second, then call 'Application.Do Events'. Quick and dirty, I know.

Nov 20 '05 #6
* "Cor" <no*@non.com> scripsit:
That is my own solution in past often told not to be good by you

:-) again the whole day gone?


A lot of work for university.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #7
>
A lot of work for university.

Well I know I missed you. :)
Nov 20 '05 #8
Hi Amrin can't we have more genearl one that can show about 100 strings on a
specified gap

Thanks
Amit
"Armin Zingler" <az*******@free net.de> wrote in message
news:O8******** ******@TK2MSFTN GP09.phx.gbl...
"AmitTrehan " <am************ @hotmail.com> schrieb
hi friends,
I want to know how can we insert delay in vb.net
like.....
i want to show two strings on same label
first one string then break of 5 secs and then second string
how can i acheive this?
i mean label should show first
label.text("bef ore")
then it should wait for 5 secs and then it should show
label.text("Aft er")
label.text = "before"
system.threadin g.thread.sleep( 5000)
label.text = "after"

Note that the app is locked during the 5 sec. If you don't want this, you
can use a Timer (see System.Windows. Forms.Timer) instead. After setting

the label the first time, enable the timer (interval = 5000). In the Timer's
Tick event, disable the timer and set the label text again.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #9
"AmitTrehan " <am************ @hotmail.com> schrieb
Hi Amrin can't we have more genearl one that can show about 100
strings on a specified gap


At class level, store the information on what string to show next. In the
Timer's Tick event:
1. Use the information to show the string.
2. Change the information (an Index in a string array? Depends on your
needs) in order to show the right string next time. For example, increment
the index.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
18836
by: Des L. Davis | last post by:
System: Dell PowerEdge Server with 3 GB RAM, 2.4 GHz Celeron Software: Microsoft SQL Server 2000 Enterprise running on Windows 2003 Server Software: Microsoft SQL Server 2000 Enterprise running on Windows 2000 Server If you run the code below, you'll notice something odd occuring. The MilliSecond value does not change after a 1Millisecond delay. Is this a bug or am I doing something wrong? Any assistance will be greatly appreciated
11
21255
by: Maheshkumar.R | last post by:
Hi groups, How i can introduce some milliseconds delay in application. How i can do achieve this... let me clearly say... (1) I'm displaying slices of medical images. For framerate - for this i'm loading 2+ slices, 4+ slices in loop to have cine impact..-> Ok working (2) But if i want to reduce the speed...how i can introduce delay inbetween
7
2943
by: mfeingold | last post by:
I am working on a system, which among other things includes a server and a ..net control sitting in an html page and connected to the server. I ran into a couple of problems, you guys might have some insight about. 1) It takes 20 sec or so to open a tcp socket from the client to the server. It just sits in the TcpClient.conect waiting for something. When I run the same control from a windows application it connects right away and works...
0
1384
by: mookie | last post by:
m looking to create something similar to #region and #endregion using treeviews the problem is that instead of #region, i am using ;fold and ;endfold i am also allowed ot have a fold within a fold and that is where i am stuck. Private Sub rtb_TextChanged(ByVal sender As System.Object, ByVal e As
14
3287
by: Steve Teeples | last post by:
I don't understand why I cannot use a property to modify data within a struct. Can someone tell me why I get the error "Cannot modify the return value of "myData.TheData" because it is not a variable. Here is what breaks. struct Data { public Data(){} private int someData;
2
3053
by: WhatHappend | last post by:
I have converted a .Net 1.0 application to .Net 2.0 and the web service invocations have delay of around 10seconds on each intial access. After the first access subsequent access are fast (After a whild of inactivity the next access will be slow agian). Changing the client to static IP address instead of DHCP makes the initial access about 1 second which is fine. Monitoring the network of the client computer the cleint is sending out 2...
3
4358
by: Sirix42 | last post by:
Hi there, when I use Firefox to run my application (this involves sending an IFRAME request to the servlet and handling the response), there is no delay in displaying the data after each response. But when I use IE, there seems to be a 1-2 second delay. The script sends a request using IFrame, goes through a loop to return script tags containing data to the browser, and then data is displayed by the browser and a new request is sent. For...
8
4235
by: Craig Williamson | last post by:
I'm trying to write a time delay loop in Borland C 3.1 (for legacy code) which has an accuracy of about 0.1ms. This change is due to a hardware change and the software is now running too fast to take proper readings. I have been using delay(1) in the past but it does not have the accuracy that I need for this situation. Does anyone know of a useful C function which can be used to create the time delay? If anyone could help that would...
3
2901
by: TamaThps | last post by:
I have to write a program that lets the user play the game of Craps. As of right now it is incomplete and I have run into some errors. It's my first time using functions instead of the program all being in the int main(). I am using visual studio on windows XP. In my code I've defined a local variable in a function but when I run the program and it gets to that function it says I have an undeclared variable. The code for the program...
0
9618
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.