Hi,
I have a bounded Ultracombo having following items in the list.
ID Code--------------------1 A 2 B3 Ccombo is binded with a table having two columns, ID and Code. DisplayMember is Code and ValueMember is ID. Whenever we type any data that is not in the list then ValueChanged event is firing twp times. Lets say I typed D in combo then
First time UltraCombo.Value comes as null and second time it comes as the data I typed ( "D" ). This is happening in 9.1 version dlls.In 8.1 version dlls it was working fine ( ValueChanged event was firing only once ). We were using 8.1 dlls and out application was designed to check value null for invalid data. After upgading the dlls all these problems get started.. Its crashing our application..
Are you guys going to fix this bug?
Thanks,Dhananjay
neosynergix said:Mike, Mike, Mike... The post was not originally to see why event ValueChanged is raise 2 times?
The original post (which is almost 2 years old) is discussing UltraCombo, not UltraComboEditor.And there's no mention anywhere of SuggestMode. So I don't think the issue you are writing about here is related to the original post or thread.
But anyway I tried out your code, and I do indeed get the event firing twice. But that's not a bug in the control, it's because you are showing a MessageBox and taking focus away from the control while it's in the middle of an update.
You should never use a MessageBox when debugging, especially when you are trying to Debug events, because the MessageBox changes the test. If you use a Debug.Writeline (or Console.Writeline if you prefer), the event only fires once.
I found a reason where the event is raise 2 times:
Here is a sample code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
For i As Integer = 0 To 10
UltraComboEditor1.Items.Add(i, i.ToString)
Next
UltraComboEditor1.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend
End Sub
Private Sub UltraComboEditor1_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles UltraComboEditor1.ValueChanged
MsgBox("ValueChanged")
End Class
If you type the value "1" in the combo, the ValueChanged is raise 2 times.
If you remove the line that set the AutoCompleteMode, the ValueChanged is raise one time.
It's a bug in Infragistics.
Here is the stack trace of the first time the event ValueChanged is raise:
Infragistics2.Win.UltraWinEditors.v10.3.dll!Infragistics.Win.UltraWinEditors.TextEditorControlBase.FireValueChanged(System.EventArgs e) + 0x69 bytes
Infragistics2.Win.UltraWinEditors.v10.3.dll!Infragistics.Win.UltraWinEditors.UltraComboEditor.OnValueChanged(System.EventArgs args) + 0x10b bytes
Infragistics2.Win.UltraWinEditors.v10.3.dll!Infragistics.Win.UltraWinEditors.TextEditorControlBase.OnValueChanged(object sender, System.EventArgs args) + 0x11 bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.EmbeddableEditorBase.RaiseValueChangedEvent() + 0x2b bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.EditorWithCombo.ProcessAutoComplete(System.Windows.Forms.Keys lastKeyDown) + 0x71e bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.EditorWithCombo.ProcessTextBoxTextChanged(out bool selectionChangedByAutoEdit = false) + 0x4d bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.EditorWithCombo.Infragistics.Win.IEmbeddableTextBoxListener.OnTextChanged() + 0xe3 bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.EmbeddableTextBox.OnTextChanged(System.EventArgs e = {System.EventArgs}) + 0x89 bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBoxBase.WmReflectCommand(ref System.Windows.Forms.Message m) + 0xb1 bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBoxBase.WndProc(ref System.Windows.Forms.Message m) + 0x42 bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBox.WndProc(ref System.Windows.Forms.Message m) + 0x36 bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.EmbeddableTextBoxWithUIPermissions.WndProc(ref System.Windows.Forms.Message m) + 0x180 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0x13 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x31 bytes
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 8465, System.IntPtr wparam, System.IntPtr lparam) + 0x64 bytes
And here is the second time:
Infragistics2.Win.UltraWinEditors.v10.3.dll!Infragistics.Win.UltraWinEditors.UltraComboEditor.OnValueChanged(System.EventArgs args) + 0x27f bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.EditorWithCombo.Infragistics.Win.IValueListOwner.OnSelectedItemChanged() + 0x1e7 bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.ValueList.SelectedIndex.set(int value) + 0x84 bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.ValueList.Infragistics.Win.IValueList.SelectedItemIndex.set(int value) + 0x5 bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.EditorWithCombo.OnSuggestModeCloseUp(Infragistics.Win.IFilterableValueList valueList, int selectedIndex) + 0xe bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.EditorWithCombo.Infragistics.Win.IValueListOwner.OnCloseUp() + 0x1f4 bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.ValueListDropDown.OnCloseUp(bool closeDropDownManager) + 0x90 bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.ValueListDropDown.OnDropDownManagerCloseUp(object sender, System.EventArgs e) + 0x10 bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.DropDownManager.Close() + 0x446 bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.DropDownManager.InternalCloseDropDown(System.Windows.Forms.Control owner) + 0x13c bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.DropDownManager.CloseDropDown(System.Windows.Forms.Control owner) + 0x3e bytes
Infragistics2.Win.v10.3.dll!Infragistics.Win.DropDownManager.DelayedCloseUp() + 0x30 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackDo(System.Windows.Forms.Control.ThreadMethodEntry tme) + 0x76 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(object obj) + 0x69 bytes
mscorlib.dll!System.Threading.ExecutionContext.runTryCode(object userData) + 0x51 bytes
As you can see, this is not the same stack trace.
I think the reason why the event is raise 2 times instead of one is not a problem in my application; this is a bug in Infragistics.
Any workaround?
Mike, Mike, Mike... The post was not originally to see why event ValueChanged is raise 2 times?
Thanks for the quick reply, i will have a look at the method you suggested.
Thanks again.