Combobox: Disable dropdown but keep text editing function?

  • Thread starter Thread starter JamesB
  • Start date Start date
J

JamesB

I have a combobox on a form that is populated with a bunch of items. A user
can select an item, and other related things on the screen fill in. I am
implementing an Edit mode, so that once clicked, the user can change the
information and save it. While in Edit mode, I would like to disable the
drop down function of the combobox, but still keep the text editing
function, as this is one of the items a user should be allowed to change. I
can't see any way of doing this though - is there anything simple?
So far, I've thought of hiding the combo and replacing with a text box while
in edit mode (and filling in/using data appropriately), offering a seperate
edit option for the combo text, or somehow "saving" the text in the box and
putting it back afterwards, but this still means the combo got "changed" so
it looks wrong...
 
JamesB said:
I have a combobox on a form that is populated with a bunch of items. A user
can select an item, and other related things on the screen fill in. I am
implementing an Edit mode, so that once clicked, the user can change the
information and save it. While in Edit mode, I would like to disable the
drop down function of the combobox, but still keep the text editing
function, as this is one of the items a user should be allowed to change. I
can't see any way of doing this though - is there anything simple?
So far, I've thought of hiding the combo and replacing with a text box
while in edit mode (and filling in/using data appropriately), offering a
seperate edit option for the combo text, or somehow "saving" the text in
the box and putting it back afterwards, but this still means the combo got
"changed" so it looks wrong...

Wouldn't ComboBox1.DropDownStyle = ComboBoxStyle.Simple do the trick for
you?

You could put it in the Combobox.Keydown event when the user starts typing.
 
Mr. Arnold said:
Wouldn't ComboBox1.DropDownStyle = ComboBoxStyle.Simple do the trick for
you?

You could put it in the Combobox.Keydown event when the user starts
typing.

Hey, you're right!

For some reason, I thought the Simple style was the one where there is no
edit box but still a dropdown - but that's actually the DropdownList one.
So yeah, works a treat.

People can still "break" it by cursoring up or down in the box (it will
still select another entry) but I think that's unlikely to happen and I'm
sure I can work around that anyway.

Thanks
James
 
Back
Top