Form refreshes on its own....

tonywilliams

Member
Joined
Feb 12, 2007
Messages
9
Programming Experience
3-5
I am creating a diary system and it loads appointments from a database. All works fine however, when a page is loaded, if left for a short while the page seems to "refresh" and reloads the information on the page.

There is no refresh command or timer commands, it just seems to do it on its own accord!

It wouldnt be a major issue but my plan was to have panels of information which begin in a collapsed state and then expand on clicking. This refreshing causes any expanded panels to collapse leaving the user having to click them again.

Any thoughts or am I going mad, and there is something hidden somewhere deep down that is lurking about?

Many Thanks
 
Pause the app, and then press F8 (single step). It should break next time whatever is causing the refresh triggers
 
Thanks, did that and it broke at the event which handles a change of date on the MonthCalender :

Private Sub MonthCalendar1_DateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateChanged

I didnt touch the computer but it just stopped. Any ideas as to why this event would be triggered on its own?

Many Thanks
 
Sorry just done some more reading up and it is a known problem with the datechanged event. Will post the explanation for anyone that may suffer with the same problem.

The explanation is, as I have found :

The MonthCalendar control simply forwards the MCN_SELCHANGE notification it
gets from OS.

The MCN_SELCHANGE notification is being sent by the Month Calendar control
every two minutes to ensure that the calendar is automatically updated in
the event that
the date should change while the control is being displayed.

However, we has a simple workaround for the application: in the
DateChangedEvent, see if e.Start and e.End point to the same day. It they
do, then the date did not really change.


Regards
 
Back
Top