I have a DevExpress LookUpEdit that I am using withing Visual Studio 2008 in VB.Net.
I have the LookUpEdit bound to my datasource and the value that it is displaying may be null or one of the rows in the datasource. My program displays a treelist and when a node is select the LookUpEdit is supposed to display the assigned value (could be null) and let the user reassign the value. I do have the LookUpEdit.Properties.AllowNullInput set to True. Right now when the program first starts if the first node in the treelist I choose has a null value the LookUpEdit displays nothing, if I change the value of the LookUpEdit the value changes in the database, if I change to a node that has a value for the LookUpEdit the value does display.
The problem is that if I switch from a node with a value to one without the LookUpEdit displays the previous value. I have gone through the debugger and it is still going through the fetch properly.
I have tried to reset the LookUpEdit.Text, LookUpEdit.EditValue and LookUpEdit.SelectedText but nothing works. I even replicated the conditions that the LookUpEdit has when it first displays nothing (LookUpEdit.Text = "" and LookUpEdit.EditValue = " ") but it still displays the last value.
I am setting the actual value with lueLocation.EditValue = lueLocation.Properties.GetKeyValueByDisplayText(valueName)
EDIT
So I narrowed it down. After I set the Text and EditValue to nothing
lueLocation.Text = Nothing
lueLocation.EditValue = Nothing
The values are set. The problem is that in the act of setting the value the dropdown menu opens. So I get it to close with lueLocation.ClosePopup()
. For some reason when it gets called it changes the .Text
and .EditValue
back to the previous values and thus calls the TextChanged Event
.
No clue why but I can't keep the dropdown menu open.