object property change in combobox

aman.alam

New member
Joined
Apr 7, 2010
Messages
2
Programming Experience
1-3
I am working on a project that uses lots of custom class objects.

Before starting work on real project, I tested the object behaviour on a temporary project. And find that if i add the object to a list and combobox and then make any change to the object property then it reflects in list and combobox.

But after using the same process in real project the change does not reflect. Why?

Also, how can i update object property placed in the combobox.

for eg.
Class X has property id and name

created objX of type Class X and set id=1 and name='All'

insert objX to combobox

now, in the same form and in other function when i get objX from combobox and change name='None', then it does not reflect in combobox.

Please help!

Thanks
 
If the object has no event to signal that its property value has changed, the ComboBox doesn't know that it needs to get a new value from the object, so it keeps displaying the old value. You would need to either provide a NameChanged event that was raised each time the Name property changed, or else implement the INotifyPropertyChanged interface.

If you're not sure how to implement events then follow the Blog link in my signature and check out my post on Custom Events.
 
Still not solved

hi jmcilhinney,

Thanks for your reply.

I tried the process you said.

Still the displaying text is not changing.

I filled the objects from array(Not setting data source). Is there any problem in using array?

Also, when i select the text then i am not getting selecteditem from combobox.

I also tried the process with a binding list and set the datasource of combobox. Its working in this condition.

Is there any property of combobox that i have to set to refresh items displaying property when filling combobox from array?
 
Back
Top