Databinding combobox to custom object - selected index / item not updating object property

I'm pulling my hair out trying to bind a custom object property to a combobox so that when the combox selecteditem is changed the value in the custom outject is updated  to reflect this change and the onPropertyChanged event occurs  - sorry if this is a really simple request:

 

Code:

object:

public class TeleconferencingInfo : INotifyPropertyChanged
{

private string test;

/// <summary>

///

/// </summary>

public string Test

{

get

{

return test;

}

set

{

test = value;

onPropertyChanged("Test");

}

 

private void onPropertyChanged(string propertyName)

{

if (PropertyChanged == null)

return;

PropertyChanged(this, new PropertyChangedEventArgs(propertyName));

}

public event PropertyChangedEventHandler PropertyChanged;

}

 

}

attempt at databinding:

 

TeleconferencingInfo _TeleconferencingInfo = new TeleconferencingInfo();

 

comboBox1.DataBindings.Add("SelectedValue", _TeleconferencingInfo, "Test");

 comboBox - items - strings "1", "2" "3" etc

any help much appreciated.

 

mit99mhAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CoyotesITCommented:
Is the control set to "AutoPostBack" = true?
0
p_davisCommented:
you might want to give you private test an instantiating value like null or string.empty.
0
mit99mhAuthor Commented:
I found a solution:

BindingSource teleconferencingBindingSource = new BindingSource();
teleconferencingBindingSource.DataSource = _TeleconferencingInfo;

myComboBox.DataBindings.Add("SelectedValue", teleconferencingBindingSource, "Test", true, DataSourceUpdateMode.OnPropertyChanged);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.