Window Form refresh

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

All,

is there window form refresh property? I try to set up window form refresh
per minute. Thanks
 
martin1 said:
is there window form refresh property? I try to set up window form refresh
per minute.

I suggest to describe in more detail what exactly you want to archieve.
 
i had window application, everytime run the app, the form_load event starts
run , what I want to do is to refresh the form-load event every minute. the
whole purpose is to refresh the app every minute.

I try to use timer to call form_load, but it fails. so any advice?

Thanks
 
Hi Martin I am afraid it's not clear at all what you want to do.
Anyway... generally talking... you can take the code necessary for the
refresh and put within a sub (instead of under the load event)

Sub RefreshMyThings
'any refresh here
end sub

you can get this sub called by a timer. Just add the timer and schedule
the refresh

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
me.RefreshMyThings
End Sub

.... what this would be good for is a mistery ! :)

-Tom

martin1 ha scritto:
 
Thank you, Tom,

I knew what you said, take refresh thing into sub, then timer control the
sub. what i want to do is refresh the window application every minute since
starting run.

one solution may or may not correct, that is timer to refresh form_load
event to meet this requirement since form_load is initilize the application,
but it doesn't work. any more advice?

Thanks
 
what are you actually trying to do? Can you post some simple code to
explain the main idea?

-tom
martin1 ha scritto:
 
Hi, Tom,

what i want to do is like web-based application refresh by setting up
<meta-equiv="refresh" content ="60">. Thanks
 
Hi Martin, I am afraid that if you do not make a little effort to
explain your problem in an intelligible manner, you won't get much help
with your problem...

-tom

martin1 ha scritto:
 
Hi Martin, I am afraid that if you do not make a little effort to
explain your problem in an intelligible manner, you won't get much help
with your problem...

-tom

martin1 ha scritto:
 
Hi, Tom,

I try to set timer to run form_load every minute, but it fail. The code
snippet is below:

-------------Code start------------
Private Sub Form_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load

'call timer for refresh app every minute
TimerAppRunPerMinute()

End Sub

'*** create timer for refresh app per minute ***
Private Sub TimerAppRunPerMinute()
AddHandler comTimerApp.Elapsed, AddressOf ComOnTimedEvent
'Set the Interval to 60 seconds.
comTimerApp.Interval = 60000
comTimerApp.Enabled = True
End Sub

Private Sub ComOnTimedEvent(ByVal source As Object, ByVal e As
ElapsedEventArgs)
Form_Load(source, e)
End Sub
----------code end--------------
 
Hi Martin,

Hmmm... your code seems meaningless to me. Why don't you say what is
what you are trying to achieve. Do you wish your form to stay on *top*
of other forms? Do you wish to *activate* it every so often. Do you
wish to *invalidate* and repaint it or what? What does the form has on
it? What is the purpose of attempting a form reload?

-tom

martin1 ha scritto:
 
hi, Tom,

What I want to do is refresh the app every minute since the app strat
running. the form load event is retrieve data from db and bind dataset to
datagridview which display data from database. Since the data in the db is
update per minute, so the datagridview should refresh every minute to
display/reflect new data. I try to reload the form to achieve this, but it
doesn't work, any alternative solution?

Thank you a lot in advance
 
Hi Martin, You have actually provided the answer yourself.
Don't put any working code under the load event.

If you need to refresh the grid, for some public display purpose,
you just re-run the extraction and binding code.

-t
martin1 ha scritto:
 
Back
Top