Combo Box Question

  • Thread starter Thread starter ed_p
  • Start date Start date
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!
 
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 :)
 
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?
 
".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
 
Back
Top