[dba-VS] Using RemoveHandler in a Combobox Base Class
Salakhetdinov Shamil
mcp2004 at mail.ru
Sat Jun 6 09:47:04 CDT 2015
Hi Dan --
I have checked with VS2012 and C#:
using System;
namespace WindowsForms.TestApp
{
public partial class MyDropDownUserControl1 : System.Windows.Forms.ComboBox
{
public MyDropDownUserControl1()
{
InitializeComponent();
}
protected override void OnEnter(EventArgs e)
{
base.OnEnter(e);
if (this.SelectedIndex == -1) this.DroppedDown = true;
}
}
}
it doesn't fire SelectedIndexChanged event.
Thank you.
-- Shamil
Wednesday, June 3, 2015 10:09 AM -05:00 from Dan Waters <df.waters at outlook.com>:
>I have a combobox base class (a custom control) which will cause the
>combobox to drop down when the control is entered and the selectedindex = -1
>(it's empty). This is a convenience for users.
>
>
>
>However, I recently discovered that when the combobox is dropped down, its
>SelectedIndexChanged event also fires, which I want to prevent. In the code
>behind the form, I can just use
>
>
>
>RemoveHandler cboName.SelectedIndexChanged, AddressOf
>cboName_SelectedIndexChanged
>
>
>
>But in the base class, I don't know how to specify what the address is for
>the combobox on the form.
>
>
>
>This is where I'm stuck:
>
>RemoveHandler, Me.SelectedIndexChanged, AddressOf [What is the address?]
>
>
>
>How can this be done?
>
>
>
>Thanks!
>
>Dan
>
>
>
>_______________________________________________
>dba-VS mailing list
>dba-VS at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-vs
>http://www.databaseadvisors.com
More information about the dba-VS
mailing list