views:

5219

answers:

2

My Application creates a DataGrid based on XML.

The XML is not optimized, but I have no control over that, so I have to "convert" it, and then add it, row by row, to the DataGrid.

I have an event handler that must be fired when any of the DataGrid's ComboBoxes (all in one column) are changed.

Problems:

  1. The event handling I have (in the attached Form1.txt file) does not work correctly. The first time you change a ComboBox, it works. When you change a second ComboBox, it fires a couple times just on Click (no change). (See Lines 100-118)
  2. I believe the multi-firing has to do somehow with the Dictionary List I am applying to the ComboBox values. I create a DisplayMember of "Key" and a ValueMember of "Value" but I don't know how to return either of them once the event has been triggered. (See Lines 114-118)

XML File: http://pastebin.com/d6a03b7e7

CS File: http://pastebin.com/m54a7a175

(all inclusive, just copy into VS2005 and Run)

A: 

This has been resolved.

I removed line 213: combo.SelectedIndexChanged -= new EventHandler(selChanged);

and inserted the following line:

cbo.SelectedIndexChanged -= selChanged;

into the selChanged function (line 221)

Thank you to Dabas over at Experts-Exchange.com!

A: 

Please attach the code to your post next time. It has now been removed from pastebin, and I think it might've been of use to others.

noroom