473,781 Members | 2,280 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
dataBindingInPr ogress, 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 1323
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*******@hotm ail.com> schreef in bericht
news:11******** **************@ g44g2000cwa.goo glegroups.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
dataBindingInPr ogress, 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*******@hotm ail.com> a écrit dans le message de
news:11******** **************@ g44g2000cwa.goo glegroups.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
dataBindingInPr ogress, 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
1700
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 like to be able to format the numbers being displayed using thousand separators, etc. could someone please point me in the right direction as to how to do this - i have not been able to find a way of doing this.
0
2349
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 visual representation of data. Two types of data binding are available for Windows Forms: Simple Data Binding and Complex Data Binding. Simple data binding allows you to bind one data element to a control. In many situations you want to display...
0
1734
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 sources to controls such as TextBox, ListBox, etc. I am clear on the concept of data flowing from data sources into web forms controls What I am not clear about is how to make the data flow the other way. When I am ready to save the changes or add a...
2
3627
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 DetailsView and then handle my updating manually. -Andrew
19
2347
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 object to databind to text boxes etc? I can't use a dataset as the object has loads of derived logic, for example updating one property may actually update several database fields for example.
2
15460
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 events allowing the user control to react to the mouse click. Setting the Enabled property on the label to False comes close, but I don't want the font color to change. Does anyone have an idea how .NET implements the code behind the Enabled...
2
4801
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 has a property with the same name, which takes an identical enum. Data binding isn't working, and I think it's because the two enums are different. Even though they have the same name and the same elements, they are declared under different...
1
6435
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 for the non-foreign key fields. When the user clicks on a row in the listbox, the comboboxes' SelectedItem changes to reflect the foreign key selections in the currently selected row. That part is working fine. I also want the textboxes to change to...
1
5280
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 handler, where would I put it? Does Page_Load() event is raised after or before control data binding takes place? Thanks, Bogdan
0
9636
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10306
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9931
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6727
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.