Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / June 2007

Tip: Looking for answers? Try searching our database.

Combobox: Disable dropdown but keep text editing function?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JamesB - 25 Jun 2007 10:11 GMT
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...
Mr. Arnold - 25 Jun 2007 12:01 GMT
>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
[quoted text clipped - 8 lines]
> 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.
JamesB - 25 Jun 2007 14:51 GMT
> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.