472,353 Members | 1,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

Start timer when form loads

I want to start a timer when an object loads, so I put the code to start it
in the constructor. The problem I am having is that when I put the object
on a form in development it starts the timer. Is there a way to get this so
that it doesn't run unless the program has actually started?
Nov 21 '05 #1
4 1435
"Altman" <No******@SickOfSpam.com> schrieb:
I want to start a timer when an object loads, so I put the code to start it
in the constructor. The problem I am having is that when I put the object
on a form in development it starts the timer. Is there a way to get this
so that it doesn't run unless the program has actually started?


\\\
If Not Me.DesignMode Then
Me.Timer1.Enabled = True
End If
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
Herfried,

Are you sure of this answer (I did not test it) however it seems so strange
for me.
Is the answer not to set the timer1.enabled = true in the form.activated
event?

For me was confusing what is meant with "when an object loads", because I do
not understand what is meant by that and I could only think about a form by
that what was busy with painting etc.

Cor

"Herfried K. Wagner [MVP]" <hi***************@gmx.at>
I want to start a timer when an object loads, so I put the code to start
it in the constructor. The problem I am having is that when I put the
object on a form in development it starts the timer. Is there a way to
get this so that it doesn't run unless the program has actually started?


\\\
If Not Me.DesignMode Then
Me.Timer1.Enabled = True
End If
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
"Cor Ligthert" <no************@planet.nl> schrieb:
Are you sure of this answer (I did not test it) however it seems so
strange for me.
Is the answer not to set the timer1.enabled = true in the form.activated
event?


I assumed that the OP placed a timer on a usercontrol and wants to disable
the timer when the control is in design mode.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4
This is correct the designmode thing works. I have a timer that is
refreshing some data with some external hardware and it kept trying to
communicate with it while I was trying to change some things in design mode.
I originally had all of this in a class and designmode is not a property of
a regular class so I made the control not make an instance of the class when
in design mode.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eu**************@TK2MSFTNGP14.phx.gbl...
"Cor Ligthert" <no************@planet.nl> schrieb:
Are you sure of this answer (I did not test it) however it seems so
strange for me.
Is the answer not to set the timer1.enabled = true in the form.activated
event?


I assumed that the OP placed a timer on a usercontrol and wants to disable
the timer when the control is in design mode.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #5

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

Similar topics

13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the...
9
by: martin1 | last post by:
Hi, All, My question is how to set up timer start 15 sec past minute. It always start 15 sec past minute. For example, if current time is...
10
by: Doug Robertson | last post by:
First off, I'm a hardware/OS guy. I just write code on the side and I'm completely self taught - so bear in mind my total lack of expertise. I...
6
by: =?Utf-8?B?QWxsZW4=?= | last post by:
When minimizing Visual Basic application, working memory is greatly reduced from about 20 MB to only about 2 MB. However I want the application to...
7
by: Smokey Grindle | last post by:
I have my entire program in a Sub Main class and it runs as a notify tray icon 99% of the time... inside the program there is a timer whihc is...
4
by: Boki | last post by:
Hi All, I have a timer, if my data queue Q has data, the timer should start work, if there is no data in Q, the timer should stop. However,...
2
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all I have some trouble with threading and AppDomain ... :-(( Within a MDI Container Form, I am loading a assembly into a AppDomain like...
12
by: =?Utf-8?B?ZXAu?= | last post by:
What is preferred method to start an app process and then fill in form fields? The following prog does not compile (b/c AppActivate does not have...
2
by: Andreas Hohn | last post by:
Hi, what is the right way to start a timer? timer.enabled = true or timer.start()?
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.