tags:

views:

24

answers:

1

Hi,

I would like to set the selected value to a known value. However, after InititializeComponent() has been called, the data is not yet filled in a databound Combobox so I can't set my selected value there.

Which event is triggered when the data has finished to be added in the combobox from the databound object ? Is there any other way you would suggest handling this ?

Many thanks

A: 

You should subscribe to the

DataSourceChanged

event of the ComboBox but if you do so you have to set DisplayMember and ValueMember first or you can't use ComboBox.SelectedValue.

comboBox1.DisplayMember = "name";
comboBox1.ValueMember = "id";
comboBox1.DataSource = dataTable;
SchlaWiener