473,387 Members | 3,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 1480
"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 situation: a computer has two access 2003 databases on...
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 8:30:45, the timer starts on 8:31:15 am; if current...
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 have a program originally written in VB2003 using...
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 start as minimized, and most of the time it will...
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 declared like this Dim WithEvents MyTimer As New...
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, there is an event can fire timer to start. Should I...
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 this: "System.AppDomain local_AppDomainPlugIn =...
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 the correct param):...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.