How to cause a repainting of a controls contents

  • Thread starter Thread starter Jerry
  • Start date Start date
J

Jerry

I'm using the format and parse events to present and interpret values in my
DataSet that I've binded to. The values are presented in units that can be
changed by the user, e.g. lb or kg. Normally the format event is fired when
the data changes. In this case the data doesn't change, just the constant
used in the format and parse methods. How do I get the controls to redisplay
the new conversion without changing the underlying DataSet? I've tried what
I thought should do it: Control.Invalidate and then Control.Update to no
avail.

Thanks,
Jerry
 
Here is a solution that seems to work. In the method created to handle unit
changes I added the following code.

//Suspend and then Resume Binding to get data to be redisplayed

BindingManagerBase myBindingMngr = this.BindingContext[EntryDataSet,
"entries"];

myBindingMngr.SuspendBinding();

myBindingMngr.ResumeBinding();

This caused all controls bound to this BindingContext to be redisplayed.
 
Back
Top