Solved

Windows Form Paint Event Not Firing Consistently-VB.Net

Posted on 2009-03-30
4
833 Views
Last Modified: 2013-11-25
I have several variables I am attepting to set when the form reloads/repaints. I am using a Binding Navigator for the first time so that may be part of the issue. When I navigate to another record, the variables which are changed in the Paint event are unchanged. However, if I move my mouse up to the closest control (a textbox) the variable suddently is changed. I've worked through several attempt to nail down the issue and it appears that the Paint event is not firing when i use the BindngNavigator to navigate throught the records. Any advice or input would be appreciated. I have way too much code to include but am attaching a video screen shot of he anomoly. Pay attention to the Currency Manager Position Value in the bottom left of the form.  Also, i have no special "MouseOver" events or anything like that.
0
Comment
Question by:mpharis
  • 2
  • 2
4 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24033931
Why dont you use an event of the binding navigator such as CurrentChanged?
0
 

Author Comment

by:mpharis
ID: 24034952
Because the record may not necessarily be changed. I want to evaluate various situations just prior to the screen redisplaying for user input to determine buttons to hide, buttons to display, button text values to be changed under certain conditions, etc. However, as you can see in the ".avi" sample, the Paint event does not seem to be firing on it's on. Only after I mouse over another control does the event fire and the values in the Paint event get changed. I am open to other methods, but the Paint event has worked fine in the past. (I am still relatively new to Forms development).

I'm looking for a standard method to:  reset values/indicators just after an action is taken on the screen and the reevaluate for certain conditions just prior to the screen becomming availible to the user.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 24036882
1) I cant see any avi attached.
2) The Paint event fires every now and then whenever the form is required to repaint itself. This includes when the form is hidden or displayed, when some other form overlaps it, when resizing, when dragging, ... etc. I think it would be a big overhead to do all processing in the paint event. Can you tell us what are the actions which may require you to hide/show form controls.
0
 

Author Comment

by:mpharis
ID: 24065738
Thanks for the input. After having a little more time to investigate and acutally record how the events fire i realized that the Paint event Fire even just for mouse movements over controls. Once I understood that it was clear that was definately the wrong event to use. The problem remained that the Activated and Deactivated events were not firing in response to All Control Actions. Specifically they did not fire when clicking one of the controls on the BindingNavigation. Resolved issue by executing Functions within the Activated and Deactivate Events and manually calling the function within Actions which do not result in the Activated/Deactivate Events.
Thanks for the responses.  
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now