ComboBox value

  • Thread starter Thread starter Matthew Wells
  • Start date Start date
M

Matthew Wells

Good Morning All,

I have a simple WinForm with a ComboBox at the top bound to a datatable.
It's set as a DropDown. When a selection is made it fires the
"SelectedIndexChanged" event. No problem. But when a user manually makes
the text blank, that event doesn't fire. Okay, I added the "TextChanged"
event to catch that. So when a user blanks out the text of the combobox,
the TextChanged event fires, I check to see if the text == "" and if so then
fire then fire the SelectedIndexChanged event. This works fine on the first
form I made.

I have a new form with the exact same setup. However, when the TextChanged
event fires after the text is deleted, the first line is

if ("" == DDApplications.Text)

which is false?

when I hover over DDApplications.Text, it shows the previous value, not ""
even though I can see on the screen it's "".

This still works fine on the first form.

Both comboboxes have the exact same properties - including the name.
All events have the exact same code - I copied it.

Any ideas?

Thanks


-- Matthew Wells
(e-mail address removed)
 
Good Morning All,
This still works fine on the first form.

Both comboboxes have the exact same properties - including the name.
All events have the exact same code - I copied it.

Any ideas?

Thanks


-- Matthew Wells
(e-mail address removed)

Sometimes "Rebuild Project" (or Clean/Build) takes care of this kind of errors. If it doesn't, try to restart the IDE.

Alex.
 
Tried all - including rebooting - no luck. But thank you.

"alex" wrote in message
Good Morning All,
This still works fine on the first form.

Both comboboxes have the exact same properties - including the name.
All events have the exact same code - I copied it.

Any ideas?

Thanks


-- Matthew Wells
(e-mail address removed)

Sometimes "Rebuild Project" (or Clean/Build) takes care of this kind of
errors. If it doesn't, try to restart the IDE.

Alex.
 
Matthew -- does the bound datatable contain the initial value of the combo box? If not, you are in trouble. Try making that change and see if it works.
 
Not quite sure how that applies. There are no blank values in the
datatable. Whenever you set a combobox's datasource, it applies the first
row of the table so I guess the answer is yes.

BTW separate tip for all, I just found out that when you set a databound
combox datasource to null, it changes the "DisplayMember" property value to
"". It leave the Valuemember alone.


"Dom" wrote in message

Matthew -- does the bound datatable contain the initial value of the combo
box? If not, you are in trouble. Try making that change and see if it
works.
 
Back
Top