Combo Box Question

E

ed_p

Hello,

I have a combo box that shows a list of items from a SQL Database. I
don't want the users to edit the entries, I have set the CombBoxStyle to
DrowpDownList, but when I do this everytime I open up the Windows Form
where the combo box resides in no item is selected. How can I set up
the combo box to have the properly selected item and still not allow
users to not modify the items?

Thanks in advance for your help!
 
G

Guest

If the user does not need to Modify, or Add items to the DropDownList, you
could change the SupressKeyPress property to true, within the controls
KeyDown event.

Example:
private void comboBox_KeyDown(object sender, KeyEventArgs e)
{ e.SuppressKeyPress = true; }

Just an Idea :)
 
E

ed_p

Hi Paul,

Thank sfor the advice, but I am unable to find the SuppressKeyPress
method for this event? Can you tell me where I can find this?
 
G

Guest

".NET Framework Class Library
KeyEventArgs.SuppressKeyPress Property
Note: This property is new in the .NET Framework version 2.0."

well i guess that might explain why you can't find it...
Sorry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top