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.
Hi Ganesh,
I'm afraid I am not following your description. The original sample we received from you was explicitly setting the Value property on the UltraCombo immediately after binding that same property to a DataSource and that's why the ValueChange event was firing when you tried to close the form.
If your actual issue is something different, then we will need you to provide and example of the actual problem so we can check it out.
ganesdpatil said:I have one class and I am binding ultra combo with one nullable property of that class using DotNet binding source. Now If I move focus then it is not firing value change, but if focus is there then on form close it is firing.
In the sample you provided us, the DotNet BindingManager is setting the Value on the combo to the value of the field it is bound to. I can only make an educated guess as to why it's doing that. For a definitive answer, you would have to check with Microsoft. But my guess is that it's happening because the current Value of the control does not match up to the value it is bound to and so the BindingManager is trying to synch up the binding. The reason the value does not match up is because you are setting the Value on the control while it does not have focus which does not make sense and the BindingManager does not track that.
Hi Mike, I have one class and I am binding ultra combo with one nullable property of that class using DotNet binding source. Now If I move focus then it is not firing value change, but if focus is there then on form close it is firing. In Sample I just tried to reproduce the issue. In my case first I intializing my class then I am setting it as DataSource to dotnet binding source. I tried same scenario with windows combo there it is behaving the way we want (its not firing value change event ) and As per I know for ultra combo is having win combo as base control, thats why I am not getting whats going wrong here. Why it is behaving differently here?
Thanks,Ganesh
What's happening here is that you are setting a Value property on a UI Control (UltraCombo) and your controls are therefore out of synch with the data source. So the next time something happens in your application, the DotNet BindingManager is trying to correct this by setting the Value on the control to the correct value from the data source.
It does not make any sense to bind the Value of an UltraCombo or any control to a data source and then try to initialize that control to some default value. The Value of that control is set by the data source you are binding to. It's like you are trying to arbitrarily change the first row of data in your data source to the default value. If that's what you want, then you should do it by setting the value of that field in the data source, not via the UI.
But either way, it doesn't make a lot of sense to me why you would do this.
Hello Ganesh,
I will be communicating with you on this one through case.
Thank you.
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?