tags:

views:

56

answers:

3

I have a WinForm that contains a bunch of labels. When the form loads I have it populate the labels with some data that I retrieve in my middle tier eg. current # of files in a certain directory.

I want to put a button on the form which when pressed will refresh all the data/labels. What should the logic of my button's click event be?

Should I be redrawing the form? Reloading? Something else?

+1  A: 

Whatever is in the Form Load event, should be put into a separate method and called from the button click event handler.

Aequitarum Custos
+1  A: 

The best way to do this is to put the relevant code in your Form_Load event into a separate procedure, and call that.

Lucas Jones
+1  A: 

It would be useful to have your population code in a separate method. You call it when loading the form. And you call it in the button event. I don recommend to put that kind of code in form drawing.

Limo Wan Kenobi