Hey,
I have still something strange.
When I made my choice in the combobox and push the Cancel-button then I want
to show the previous values (the values I had before) and I do this now like
this :
f (kwijting.SoortKwijting == null )
this.Cmb.SelectedIndex = -1;
else
this.Cmb.SelectedValue = kwijting.SoortKwijting.Id;
This works fine. But then I push the Add-button (add new record). I want to
clean up all the values in the screen (want all my comboboxes, textfields
etc. are empty, so I can start to fill in the screen).
So, for the comboboxes I do this :
this.Cmb.SelectedIndex = -1;
If I look in 'QuickWatch" he changes my selectedindex not to -1, but to 1.
And so he gives me always the first choice in view of the combobox.
When I do it like this :
this.Cmb.SelectedIndex = -1;
this.Cmb.SelectedValue= -1;
Then the combobox view is empty.
I don't understand that I have to do 2 things. What can be wrong here?
Because selectedvalue is filled up? But that is normal?
Thanks for help.
Jac
"Jac" wrote:
Hey,
How can I set the display value of a combobox empty? But all the posible
choices are available when I push the trianglebut.
Sometimes if I set the selecteditem = null it works, other times it don't
work and sometimes I receive an error 'Additional information: Value cannot
be null'.
this.CmbDataSource = SoortKwijtingList.Items; // Arraylist
this.Cmb.DisplayMember = "Omschrijving";
this.Cmb.ValueMember = "Id";
this.Cmb.SelectedItem = null;
I don't understand that, what is so unstable? Has it something to do with
the moment of databinding?
Thanks in advance
jac