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!

RE: Combo Box Question by PaulSamways

PaulSamways
Thu Sep 22 08:10:09 CDT 2005

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 :)
"ed_p" wrote:

> 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!
>

Re: Combo Box Question by ed_p

ed_p
Thu Sep 22 11:43:22 CDT 2005

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?

Paul Samways wrote:
> 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 :)
> "ed_p" wrote:
>
>
>>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!
>>

Re: Combo Box Question by PaulSamways

PaulSamways
Thu Sep 22 19:17:07 CDT 2005

".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


"ed_p" wrote:

> 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?
>
> Paul Samways wrote:
> > 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 :)
> > "ed_p" wrote:
> >
> >
> >>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!
> >>
>