cancel
Showing results for 
Search instead for 
Did you mean: 

Timer to auto refresh

Former Member
0 Kudos

Hi,

How can we add a timer to refresh a UDO form periodically?

Data are updated by multiple users into the DB round the clock. A UDO form is used to consolidate the data so, we need to refresh the form every 5 mins to get updated info.

I am using VB and 2004B. Your help is needed. Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Rowdy,

I am using VB6 and not really sure can VB6 do multi-threading. Please let us know if you have leads to where can I find sample codes to accomplish the auto refresh.

Jaro,

I will try out your method as well.

Thanks, guys.

Former Member
0 Kudos

This is one of the first results from google with keywords "vb6 thread"...

http://www.freevbcode.com/ShowCode.Asp?ID=4029

Hope it helps...

Grtz, Rowdy

Former Member
0 Kudos

It may not be possible but, any suggestion will be helpful.

Former Member
0 Kudos

Hi,

here's my idea:

what about adding a check into some loop, which is always running, while the addon is active ...

try putting it into the "SubMain" - "SubMain.bas" in your project

there should be something like as

Do While GetMessage(Msg, 0&, 0&, 0&)

TranslateMessage Msg

DispatchMessage Msg

DoEvents

Loop

and add there some function to "get time" compare it with last update ... and if neccessarry, initiate update of the form ...

Don't know if it will work ... but ... it might ... because whenever I do pause addon, it stays in the loop ...

Jaro

Former Member
0 Kudos

Sure it's possible... Just make a multithreaded application...

One thread (the mainthread) for your add-on, and one thread that peridocally updates that form. When the form is opened, create a new thread and give the formUID as parameter. Whit that, create a while(true) loop. In that loop update the form, and then sleep the thread for 300000ms (=5x60x1000, is 5 minutes). So as long as that thread lives, it will try to update the form.

When you close the form, just kill the tread and your fine...

We did something simular a few years ago...

I don't know the right syntax now, but Google has your answer... Just search for code samples with multithreaded as subject for vb(.NET). (Just threads and vb(.NET), it's not a really SBO issue)

Hope it helps! Grtz, Rowdy