(combobox) how to ... or how to ...

  • Thread starter Thread starter Koliber (js)
  • Start date Start date
K

Koliber (js)

how to put a text value in edit field of combobox
when this text value is none of contained if combobox

or

how to change selected by click text value from combobox
without removing it and inserting changed into it


:(

Ck
 
Hi,

Koliber (js) said:
how to put a text value in edit field of combobox
when this text value is none of contained if combobox

Did you try setting Combobox.Text?
or

how to change selected by click text value from combobox
without removing it and inserting changed into it

Not clear what you want, could you care to be more especific?
 
Ignacio Machin ( .NET/ C# MVP ) napisa (a):
Hi,



Did you try setting Combobox.Text?

yes - it does not work - possibly sets text but immediately after that
something
outside my code sets it to empty
Not clear what you want, could you care to be more especific?

if I do

this.cmbFilter.Items.RemoveAt(index);
this.cmbFilter.Items.Insert(index, text);

then my edit field become empty and I cannot insert nothing in it
because it
clears to empty (can only select item combobox contains to its edit)

(but with some spelly somme messy code with dropdown dropdownclose
it seem thai it does what i need this moment but is gennerally messy
thing
that setting Combobox.Text does not work
 
how to put a text value in edit field of combobox
when this text value is none of contained if combobox

or

how to change selected by click text value from combobox
without removing it and inserting changed into it

It's hard for me to be sure I understand your question perfectly, but it
sounds to me as though you need the ComboBox.SelectedIndex property:

this.cmbFilter.Items.RemoveAt(index);
this.cmbFilter.Items.Insert(index, text);
this.cmbFilter.SelectedIndex = index;

Or possible just the last line. A previous reply in this thread from you
suggests you _want_ to remove and re-add an item, but perhaps not. If
not, just set the SelectedIndex property to whatever you want, without
removing and adding the item.

As for the first question, I'm not positive it's possible, but if the
ComboBox.Text property isn't working for you, perhaps you can try
ComboBox.SelectedText.

Pete
 
In order to do that, you would probably need to set the combobox
dropdownstyle to DropDown - Not DropDownList - if you haven't already

Cheers,
Johnny J.
 
Back
Top