473,320 Members | 2,041 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,320 software developers and data experts.

keeping it running...

Hi,

When I create a program with a form, the form doesn't go away until I close
it somehow.
How is this done, can it also be done with a module or a class?

What I seek is this:

I wrote a program that runs in a sub Main().
At this moment I use a DO WHILE LOOP to have the program do something every
5 minutes.
I didn't use a timer, I used this:

do while stop = false
ac = now.addminutes(5)
do while now < ac
...do nothing
application.doEvents()
loop
...something
loop

The problem is, it slows down the pc.
I cannot use a timer because when the sub ends, the timer is disposed.

How can I use a timer and still not a form?
How do prevent the timer object to be disposed?
How can I stay within the sub Main without slowing down the pc (actually a
PDA)?

Please help.

rg,
Eric
Mar 14 '06 #1
4 1183
Eric,

In your current approach you can use
threading.thread.sleep(seconds)

What you want however seems a windowservice

To hide a form you can tell, me.hide or me.visible = false (assuming the
form is your mainclass).

I hope this gives some ideas

Cor

"Eric" <so*****@MicroZoft.com> schreef in bericht
news:44**********************@text.nova.planet.nl. ..
Hi,

When I create a program with a form, the form doesn't go away until I
close it somehow.
How is this done, can it also be done with a module or a class?

What I seek is this:

I wrote a program that runs in a sub Main().
At this moment I use a DO WHILE LOOP to have the program do something
every 5 minutes.
I didn't use a timer, I used this:

do while stop = false
ac = now.addminutes(5)
do while now < ac
...do nothing
application.doEvents()
loop
...something
loop

The problem is, it slows down the pc.
I cannot use a timer because when the sub ends, the timer is disposed.

How can I use a timer and still not a form?
How do prevent the timer object to be disposed?
How can I stay within the sub Main without slowing down the pc (actually a
PDA)?

Please help.

rg,
Eric

Mar 14 '06 #2
thanks, Cor,

In fact I choose not to use a form, because I don't have anything to put on.
My program is to get gps data from the VDO Dayton navigation computer by
serial connection and send them to a ASP website.
I use the notification balloon and icon to give the user a interaction (some
info and two link buttons).

I will give your first option a try.

Thanks!!
Eric

"Cor Ligthert [MVP]" <no************@planet.nl> schreef in bericht
news:ug**************@TK2MSFTNGP12.phx.gbl...
Eric,

In your current approach you can use
threading.thread.sleep(seconds)

What you want however seems a windowservice

To hide a form you can tell, me.hide or me.visible = false (assuming the
form is your mainclass).

I hope this gives some ideas

Cor

"Eric" <so*****@MicroZoft.com> schreef in bericht
news:44**********************@text.nova.planet.nl. ..
Hi,

When I create a program with a form, the form doesn't go away until I
close it somehow.
How is this done, can it also be done with a module or a class?

What I seek is this:

I wrote a program that runs in a sub Main().
At this moment I use a DO WHILE LOOP to have the program do something
every 5 minutes.
I didn't use a timer, I used this:

do while stop = false
ac = now.addminutes(5)
do while now < ac
...do nothing
application.doEvents()
loop
...something
loop

The problem is, it slows down the pc.
I cannot use a timer because when the sub ends, the timer is disposed.

How can I use a timer and still not a form?
How do prevent the timer object to be disposed?
How can I stay within the sub Main without slowing down the pc (actually
a PDA)?

Please help.

rg,
Eric


Mar 14 '06 #3
Great, I got it working.
But...one question...

I did it like this:

Dim Th2 As Threading.Thread
Do While progStop = False
Th2 = New Threading.Thread(AddressOf nwTH)
Th2.Start()
Threading.Thread.Sleep(0)
Th2.Join()
Threading.Thread.Sleep(300000)
Application.DoEvents()
Loop

In the thread Th2 I do the stuff I need to do and I use Notification to
report it to the user.
While in sleep mode (5 minutes), the user can still open the Notification
Balloon and click on one of the two link buttons (settings and stop).
When he clicks on Stop, the variable progStop will be set tot true but the
application will still be sleeping.

Is it possible to force a thread to come out of sleep?

rg,
Eric

"Cor Ligthert [MVP]" <no************@planet.nl> schreef in bericht
news:ug**************@TK2MSFTNGP12.phx.gbl...
Eric,

In your current approach you can use
threading.thread.sleep(seconds)

What you want however seems a windowservice

To hide a form you can tell, me.hide or me.visible = false (assuming the
form is your mainclass).

I hope this gives some ideas

Cor

"Eric" <so*****@MicroZoft.com> schreef in bericht
news:44**********************@text.nova.planet.nl. ..
Hi,

When I create a program with a form, the form doesn't go away until I
close it somehow.
How is this done, can it also be done with a module or a class?

What I seek is this:

I wrote a program that runs in a sub Main().
At this moment I use a DO WHILE LOOP to have the program do something
every 5 minutes.
I didn't use a timer, I used this:

do while stop = false
ac = now.addminutes(5)
do while now < ac
...do nothing
application.doEvents()
loop
...something
loop

The problem is, it slows down the pc.
I cannot use a timer because when the sub ends, the timer is disposed.

How can I use a timer and still not a form?
How do prevent the timer object to be disposed?
How can I stay within the sub Main without slowing down the pc (actually
a PDA)?

Please help.

rg,
Eric


Mar 15 '06 #4
Eric,

No, but are you sure that you should let that worker thread sleep. In my
opinion if that is true, than it is better to create a new worker thread and
let the other one die because it is ready.

Just my thought,

Cor

"Eric" <so*****@MicroZoft.com> schreef in bericht
news:44**********************@text.nova.planet.nl. ..
Great, I got it working.
But...one question...

I did it like this:

Dim Th2 As Threading.Thread
Do While progStop = False
Th2 = New Threading.Thread(AddressOf nwTH)
Th2.Start()
Threading.Thread.Sleep(0)
Th2.Join()
Threading.Thread.Sleep(300000)
Application.DoEvents()
Loop

In the thread Th2 I do the stuff I need to do and I use Notification to
report it to the user.
While in sleep mode (5 minutes), the user can still open the Notification
Balloon and click on one of the two link buttons (settings and stop).
When he clicks on Stop, the variable progStop will be set tot true but the
application will still be sleeping.

Is it possible to force a thread to come out of sleep?

rg,
Eric

"Cor Ligthert [MVP]" <no************@planet.nl> schreef in bericht
news:ug**************@TK2MSFTNGP12.phx.gbl...
Eric,

In your current approach you can use
threading.thread.sleep(seconds)

What you want however seems a windowservice

To hide a form you can tell, me.hide or me.visible = false (assuming the
form is your mainclass).

I hope this gives some ideas

Cor

"Eric" <so*****@MicroZoft.com> schreef in bericht
news:44**********************@text.nova.planet.nl. ..
Hi,

When I create a program with a form, the form doesn't go away until I
close it somehow.
How is this done, can it also be done with a module or a class?

What I seek is this:

I wrote a program that runs in a sub Main().
At this moment I use a DO WHILE LOOP to have the program do something
every 5 minutes.
I didn't use a timer, I used this:

do while stop = false
ac = now.addminutes(5)
do while now < ac
...do nothing
application.doEvents()
loop
...something
loop

The problem is, it slows down the pc.
I cannot use a timer because when the sub ends, the timer is disposed.

How can I use a timer and still not a form?
How do prevent the timer object to be disposed?
How can I stay within the sub Main without slowing down the pc (actually
a PDA)?

Please help.

rg,
Eric



Mar 15 '06 #5

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

Similar topics

8
by: jrf[no] | last post by:
Hi all, I was getting a 500 error and someone adviced me to run the php file from the command line to check what errors that would come up with. Great idea which I'd like to use, but when I...
12
by: marcadonis | last post by:
Hi! Does anybody know of a way that I can keep a reference to an object that I can then reuse? I tried various approaches using navigator, but these all fail in an iframe due to premission...
5
by: Mike Turco | last post by:
I've been upgrading since VB3 and Access 2. How long do I have to keep these CD's around as proof of valid licensing?
5
by: Alan Webb | last post by:
Guys, I get this: Regular Hours are any hours less than the number of hours that can be worked before the hours begin to be counted as overtime in the period. Overtime Hours are any hours...
7
by: Shannan Casteel via AccessMonster.com | last post by:
I have a form for entering part numbers along with the associated quantity for each part. There are 25 Part fields and 25 associated Quantity fields. If I go to record 1 and enter part number 1234...
4
by: Beenish Sahar Khan | last post by:
I want to start my application so that its notify icon is added to the system tray, i don't want to show any starting form. I want user to interact through the notify icon...just like MSN. Is there...
2
by: Steve W | last post by:
Is it possible to keep some communication going between the browser and web server going while waiting for a long running process to finish ? We have one function on our app (ASP.NET / VB.NET)...
0
by: Joergen Bech | last post by:
Source: ------------ http://home1.inet.tele.dk/jbech/binaries/threadingtest.zip (25K) Scenario: --------------- Main form with two listboxes, a textbox, a button, and a trackbar. Clicking...
5
by: Bryan | last post by:
It seems that the following sub is keeping the ACCESS.EXE process running in task manager after I close the program. I can't see why. I call it from several places throughout my program to...
4
by: Marina Levit | last post by:
I am trying to do some processing on a background thread while keeping the UI painting. However, this is a generic server side call routine - and it needs to block until the server side call...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.