Extending ComboBox functionality - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Extending ComboBox functionality

Hey !
I'm a new developer in control authoring. I'm developing an app. that has over ten combo box controls with the same use. They're just used to pick data from other tables and I do not want my end-users to be able to type but just stick to what is in the combo.

My solution was to find a way of incorporating the following procedures into a custom control which I would just drag and drop.My problem is that I'm not able to do this.

My any body with knowledge in control authoring help ?


private void cbo_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
e.Handled=true;
}

private void cbo_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyCode==Keys.Delete)e.Handled=false;
}

private void cbo_MouseEnter(object sender, System.EventArgs e)
{
cbo.ContextMenu=new ContextMenu();
}

Comments

  • WEBMASTERWEBMASTER Posts: 549Member
    You have to change the DropDownStyle property to
    DropDownList to prevent editing of a combobox.

    /WEBMASTER

    [blue][italic][b]/WEBMASTER[/b][/italic][/blue]

  • kevinabasikevinabasi Posts: 2Member
    : You have to change the DropDownStyle property to
    : DropDownList to prevent editing of a combobox.
    :
    : /WEBMASTER
    :
    : [blue][italic][b]/WEBMASTER[/b][/italic][/blue]
    :
    :

Sign In or Register to comment.