469,890 Members | 2,158 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,890 developers. It's quick & easy.

Combobox problems with selectedindex and selectedvalue

jac
Hey,

this.CmbDataSource = SoortKwijtingList.Items; // Arraylist
this.Cmb.DisplayMember = "Omschrijving";
this.Cmb.ValueMember = "Id";
this.Cmb.SelectedIndex = -1;
(short description : I have a grid and an input area with a textfields,
combobox and 3 buttons add, update and delete. add : make a new record with
the input fields and add it to the grid, update ; change the record in scope
with the new values in the input fields; del : delete the record in scope)

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 of the selected record)
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

Nov 17 '05 #1
0 1565

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Supa Hoopsa | last post: by
3 posts views Thread by Bill C. | last post: by
2 posts views Thread by pei_world | last post: by
6 posts views Thread by Mike Caputo | last post: by
30 posts views Thread by dbuchanan | last post: by
5 posts views Thread by Peter M. | last post: by
reply views Thread by Frnak McKenney | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.