vb.net Code for refreshing a form from an application every certain period of time

zandizza
zandizza used Ask the Experts™
on
Hi, I have a form with labels showing  data.  Every time the form is loaded the value of the controls are refreshed. But only when the form is loaded.

I want to programm a button which when clicked, the page gets refresh .

Is there a more proper way to do it, besides than calling itself. e.g.  me.load ?



Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009
Commented:
You can move the code to a Sub instead:

    Private Sub Form1_Load(...) Handles MyBase.Load
        RefreshData()
    End Sub

    Private Sub Button1_Click(...) Handles Button1.Click
        RefreshData()
    End Sub

    Private Sub RefreshData()
        ...
    End Sub
Odd that the labels aren't updating themselves and that your UI is still responsive.  Have you tried throwing an application.doevents statement into any long running loops you have?
Dirk HaestProject manager

Commented:
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial