Hi Mike, I have one ultra combo and Windows ComboBox in one winform with following settings : private void Form1_Load( object sender, EventArgs e ) { //creating dummy data DataTable dt = new DataTable(); DataColumn col = new DataColumn( "ID", typeof( int ) ); dt.Columns.Add( col ); col = new DataColumn( "Name", typeof( string ) ); dt.Columns.Add( col ); DataRow row = dt.NewRow(); row [ 0 ] = 1; row [ 1 ] = "aa"; dt.Rows.Add( row ); row = dt.NewRow(); row [ 0 ] = 2; row [ 1 ] = "bb"; dt.Rows.Add( row ); dt.AcceptChanges(); DataTable business = new DataTable(); col = new DataColumn( "BID", typeof( int ) ); business.Columns.Add( col ); row = business.NewRow(); row [ 0 ] = 2; business.Rows.Add( row ); //Win combo this.comboBox.DataSource = dt; this.comboBox.DisplayMember = "Name"; this.comboBox.ValueMember = "Id"; this.comboBox.DataBindings.Add( "SelectedValue", business, "BID", true, DataSourceUpdateMode.OnPropertyChanged ); this.comboBox.SelectedValue = -1; this.comboBox.SelectedValueChanged += new EventHandler( comboBox1_SelectedValueChanged ); //Ultra combo ultraCombo.AllowNull = Infragistics.Win.DefaultableBoolean.True; ultraCombo.NullText = "Unassigned"; ultraCombo.DataSource = dt; ultraCombo.ValueMember = "Id"; ultraCombo.DisplayMember = "Name"; ultraCombo.DataBindings.Add( "Value", business, "BID", true, DataSourceUpdateMode.OnPropertyChanged ); ultraCombo.Value = null; ultraCombo.ValueChanged += new EventHandler( ultraCombo_ValueChanged ); } void comboBox1_SelectedValueChanged( object sender, EventArgs e ) { MessageBox.Show( "Win : selected index changed" ); } void ultraCombo_ValueChanged( object sender, EventArgs e ) { MessageBox.Show( "Ultra combo : selected index changed" ); }If focus is in UltraCombo and selected value is null, On Close of form it is firing ValueChange event.I tried same thing with windows ComboBox and it works fine(It wont fire value change event on form close).Is there any way to stop this thing? Because in ValueChange event I am setting some flags and based on it I am showing warning message to save the changes. In my case without doint anything if we close form it is asking for Save.Please reply me as soon as possible.
Hello Ganesh,
The issue is arising because the UltraCombo is bound to a datasource and its Value property is set programmatically to Null.
Databinding does not handle programmatic changes to UI controls. The BindingManager does not track changes on the controls that do not have focus. The BindingManager expects that the only changes it should track are those made by the user.
If the bound field needs to be updated or set, we recommend the following (in order of preferrence):
1. Set the value of the field in the DataRow and do not make programmatic changes to the data via the UI Controls.
OR
2. Use DBNull.Value instead of null. DBNull.Value is not the same as null. (This is why the ValueChanged event was fired).
Please let me know if you have further questions regarding this issue or suggested solutions.
Thank you for choosing Infragistics
Hi Vivian, I just gave one sample where this problem can reproduce.
Vivian"]The issue is arising because the UltraCombo is bound to a datasource and its Value property is set programmatically to Null.
Actually in my project we have one class in which we have one property type of long?(nullable). I am setting value property of Combo to that property. By default for that property value is null. then also if focus is in UltraCombo it is firing value change event only on form close.
If same thing is happening on from close then why it is not happening on on focus leave?
Thanks,Ganesh