Solved

Windows Form Paint Event Not Firing Consistently-VB.Net

Posted on 2009-03-30
4
852 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What are MicroServices? 4 66
Data Analysis 7 58
e commerce steps shown instead of self testing 2 54
CSS styling problem 3 22
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

738 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