Showing results for 
Search instead for 
Do you mean 

Right way to hook into a picklist

New Member
Posts: 1
Country: USA

Right way to hook into a picklist



I am trying to fire code when a picklist changes in the Desktop client.


So far i have tried to hook into the textchanged event of the dropdown by locating the control using


foreach (Control ct in this.application.Controls[0].Controls["ContactDetailView"].Controls["PanelDetail"].Controls) {

            if ( = "New Control 12" )    ct.Controls[0].TextChanged += fld_TextChanged

But the problem is that this event is fired when the user move back and forward in contacts, already hooked into currentcontactchanging and currentcontactchanged  to have a flag for current contact, but such events are fired before the control is filled with the new data, so i am getting false positives that the text changed.


 private void fld_TextChanged(object sender, EventArgs e)
            // flag indicate that ACT is not switching users, and dropdown have a value
            if (!changing && ((System.Windows.Forms.Control)sender).Text != "")
                   // get value from current contact
                Contact ct = this.application.ApplicationState.CurrentContact;
                string vl = GetValue(ct, "TBL_CONTACT.CUST_Case_053719961");

                // if value from current contact is not the same in the dropdown
                if ( vl != ((System.Windows.Forms.Control)sender).Text)                        System.Windows.Forms.MessageBox.Show(((System.Windows.Forms.Control)sender).Text);


Is there a better way to create a control that inherits from nupicklistcontrol ? i need to keep the ACT picklist control to continue working ( with the checkboxes, etc ), do not want to create a custom control with the standar dropdown.