473,405 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Can I ignore xxxChanged events while data binding?

Here's the scenario:

Show the user a list of Things. User picks one, and the Thing edit
frame is populated with the details of the Thing they picked. This
frame has Save / Discard buttons that are initially disabled. When the
user makes a change to any of the details of the Thing, those buttons
become enabled (because there are now changed to Save or Discard).

So I have a ThingDirty property, and all the xxxChanged events of the
Thing detail controls set ThingDirty = True, and in the Property Set of
ThingDirty, I set the Enabled of the Save / Discard buttons to the new
value of ThingDirty. Furthermore, I set ThingDirty to False just after
populating the detail area.

Almost perfect. Except - when the user picks a thing, the detail area
is populated through the magic of data binding - and this triggers all
those xxxChanged events. So every time a Thing is selected, the Save /
Discard buttons briefly flash enabled (as the data binding happens)
before being set disabled.

My workaround is a horrible form-level variable called
dataBindingInProgress, which I manually set/reset around the data read
operation, and which when set tells the Property Set *not* to touch the
Enabled of the buttons. Is there a more'built-in' way? Like a property
on the BindingSource (or somewhere) that means 'binding in progress'?
So the controls can know they are being *initialised* and not *changed*
?

--
Larry Lard
Replies to group please

Feb 17 '06 #1
2 1308
Hi Larry

you could use removehandler and addhandler on the controls, remove all the
handlers before databinding and then add them again afterwards

Hope this helps

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Larry Lard" <la*******@hotmail.com> schreef in bericht
news:11**********************@g44g2000cwa.googlegr oups.com...
Here's the scenario:

Show the user a list of Things. User picks one, and the Thing edit
frame is populated with the details of the Thing they picked. This
frame has Save / Discard buttons that are initially disabled. When the
user makes a change to any of the details of the Thing, those buttons
become enabled (because there are now changed to Save or Discard).

So I have a ThingDirty property, and all the xxxChanged events of the
Thing detail controls set ThingDirty = True, and in the Property Set of
ThingDirty, I set the Enabled of the Save / Discard buttons to the new
value of ThingDirty. Furthermore, I set ThingDirty to False just after
populating the detail area.

Almost perfect. Except - when the user picks a thing, the detail area
is populated through the magic of data binding - and this triggers all
those xxxChanged events. So every time a Thing is selected, the Save /
Discard buttons briefly flash enabled (as the data binding happens)
before being set disabled.

My workaround is a horrible form-level variable called
dataBindingInProgress, which I manually set/reset around the data read
operation, and which when set tells the Property Set *not* to touch the
Enabled of the buttons. Is there a more'built-in' way? Like a property
on the BindingSource (or somewhere) that means 'binding in progress'?
So the controls can know they are being *initialised* and not *changed*
?

--
Larry Lard
Replies to group please

Feb 17 '06 #2
Not sure but you could also try SuspendBinding. REsumeBindig...

--

"Larry Lard" <la*******@hotmail.com> a écrit dans le message de
news:11**********************@g44g2000cwa.googlegr oups.com...
Here's the scenario:

Show the user a list of Things. User picks one, and the Thing edit
frame is populated with the details of the Thing they picked. This
frame has Save / Discard buttons that are initially disabled. When the
user makes a change to any of the details of the Thing, those buttons
become enabled (because there are now changed to Save or Discard).

So I have a ThingDirty property, and all the xxxChanged events of the
Thing detail controls set ThingDirty = True, and in the Property Set of
ThingDirty, I set the Enabled of the Save / Discard buttons to the new
value of ThingDirty. Furthermore, I set ThingDirty to False just after
populating the detail area.

Almost perfect. Except - when the user picks a thing, the detail area
is populated through the magic of data binding - and this triggers all
those xxxChanged events. So every time a Thing is selected, the Save /
Discard buttons briefly flash enabled (as the data binding happens)
before being set disabled.

My workaround is a horrible form-level variable called
dataBindingInProgress, which I manually set/reset around the data read
operation, and which when set tells the Property Set *not* to touch the
Enabled of the buttons. Is there a more'built-in' way? Like a property
on the BindingSource (or somewhere) that means 'binding in progress'?
So the controls can know they are being *initialised* and not *changed*
?

--
Larry Lard
Replies to group please

Feb 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Saix News | last post by:
hi, i have a dataset and a number of controls that are bound to it. some of the records being displayed are numerical and are bound to text boxes. they display without a problem but i would...
0
by: Ann Morris | last post by:
INTRODUCTION One of the most powerful aspects of .NET and Windows Forms is data binding. Data binding is the process of associating user interface (UI) elements with a data source to generate a...
0
by: popsovy | last post by:
Hi I have a question about whether Data Binding can facilitate the process of saving data in a web application I learned that you can data bind information from a number of different data...
2
by: Andrew Robinson | last post by:
Is there any way to accomplish two way data binding in a Details View with a DataSet or DataTable as the DataSource. All I want is to get an updated DataSet or DataTable back from the...
19
by: Simon Verona | last post by:
I'm not sure if I'm going down the correct route... I have a class which exposes a number of properties of an object (in this case the object represents a customer). Can I then use this...
2
by: bretth | last post by:
In a VB.Net Windows Forms application, I have a user control that handles mouse events. Another section of code programmatically adds a label to the control. I would like label to ignore all...
2
by: David Veeneman | last post by:
I want to data bind a user control and a business object, using a BindingSource control. The control has a 'Priority' property that takes a 'Priority' enum (High, Normal, Low). The business object...
1
by: Peter | last post by:
Hi, I'm trying to create a form that shows table rows in a listbox. Several comboboxes expand the foreign key fields into text values from the parent tables, and there are also some textboxes...
1
by: bogdan | last post by:
I need to execute some code _after_ page controls are bound to data (e.g. DropDownList). I could probably handle DataBound events for each control. But if I wanted to place the code in a page...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.