Strange ComboBox Behavior

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

I have two ComboBoxes on a form both set to a different datasource. When
retrieving the SelectedText from one the other's SelectedItem property goes
to -1. If I remove one or the other they work fine independantly. If they
were both set to the same datasource I might understand but they are
connected to two seperate datasources. Any ideas?
 
Stranger yet.

So, I tried manually loading the ComboBoxes and that did not fix the
problem. I created events for each of the comboBoxes shown below. The
events only fire when you change values in the combobox as you would expect.
But the really strange part is that creating these events fixed the
problem!!!!

private void ddlCategory_SelectedIndexChanged(object sender,
System.EventArgs e)
{
string strTemp = "";
}

private void ddlObsUnits_SelectedIndexChanged(object sender,
System.EventArgs e)
{
string strTemp = "";
}
 
Hi Eric,

From you description, the ComboBoxes are using difference datasources, then
I'd like to know if there is any other bindings on these ComboBoxes, such
as ValueMember, SelectedItem etc.
Could you let me know more about this problem, then I could do some
research on it to give further suggestions.
Also if it's easy to make a simple project to reproduce this problem,
please feel free to send it to me by mail.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
 
Ying-Shen,
I have tried to forward you a test project to
'(e-mail address removed)' but it comes back undeliverable due to an
unknown server?

Eric Owens
 
Hi Eric,

I'm sorry for not making it clear earlier, you need remove the word
"online" and the dot after it before sending the mail to me as described in
my signature.


Best regards,

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
 
Hi Eric,

The SelectedText should be empty since focus was switched off the combbox,
when you click the button. no text was selected when the event handler was
executing.
I added a timer on to the form and print out the SelectedText property of
ComboBox ddlCategory, as you can see you you put left mouse down on the
save button, the SelectedText property become empty if you set focus back
to the comboBox , the SelctedText property return to "Tester1".

Does this behavior related to your original problem?

Also, since you said the item on another ComboBox got changed when you set
the SelectedText property on one ComboBox. Maybe you can handle the
PositionChanged event on the currencymanager of that datasource, then set a
breakpoint in the event handler, then get a complete stack trace on that
point (Note you may need load corresponding symbol file to get complete
information). Of course it would be better if you could give me a sample
program to reproduce it on my side.

Please feel free to update this thread if you have any updates on it.
Thanks!


Best regards,

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
 
Back
Top