Question Me.Refresh

ALX

Well-known member
Joined
Nov 16, 2005
Messages
253
Location
Columbia, SC
Programming Experience
10+
Here's what should be a no brainer that has me stumped...
Much earlier in my project's development, I used a simple statement "Me.Refresh" to redraw a form at certain points during the user's input. Many months later, while testing the project, I noticed that the form was not refreshing at these points anymore. With break points, I confirmed that the code containing the "Refresh" statement was being executed but the form was not actually refreshing. My question is: Under what conditions can this occur? I'm not overriding the Refresh command... The form is not DoubleBuffered... I'm at a loss here ! Any ideas ??? :ambivalence:
(This is VB2008 w/3.5 and 4.0 Framework)
 
There are no circumstances under which that should happen so, if it is indeed happening for you, either your project or your system is broken.

First, what exactly are you doing, what exactly are you expecting to see and what exactly are you seeing? If there is indeed an issue then I'd try a few things:

1. Run a Release version of the EXE instead of a Debug version and see if it behaves the same way.
2. Run your project on another machine and see if it behaves the same way.
3. Try to reproduce the issue in another project built from scratch.
 
Yep! Yet another bone-headed move on my part. Single stepping thorough the code can be tricky. I couldn't put my break point in the Paint event handler because it would break every time I tried to step ahead; so I put the break point at the Me.Refresh statement. When single stepping ahead from there did not lead me directly to the Paint event, I assumed that the event was not being raised. I guess the newer versions of VB skip over some of the mundane, internal sections when stepping through the code. The Paint event was actually occurring, I just screwed up the code to make it behave correctly, which made it appear as if the form was not refreshing. It amazes me how I can make these amateur mistakes after so many years of coding.
 
When you're unable to set a breakpoint like that, I'd suggest using Debug.WriteLine or Console.WriteLine to send some tracing information to the Output window. The advantage of Debug is that it can be left in without affecting release code. The advantage of Console is that the output will appear immediately, while Debug may not.
 
Back
Top