KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Here is a short program that reproduces the problem I just encountered. This was compiled under MS Windows 7 with .NET 4.0, just in case that makes a difference. using System; using System.Drawing; using System.Windows.Forms; // Compile with "csc /target:exe /out:comboboxbug.exe /r:System.dll /r:System.Drawing.dll /r:System.Windows.Forms.dll comboboxbug.cs" // in a Visual Studio command prompt. static class Program { [STAThread] static void Main() { //Create a label. Label oLabel = new Label(); oLabel.Location = new Point (10, 10); oLabel.Size = new Size (100, 15); oLabel.Text = "Combo box bug:"; // Create a combo-box. ComboBox oComboBox = new ComboBox(); oComboBox.Location = new Point (10, 50); oComboBox.Size = new Size (150, 21); oComboBox.Items.AddRange (new object[] { "A", "A B", "A C", "A B C", "A C B", "A B C D", "A C B D" }); oComboBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend; oComboBox.AutoCompleteSource = AutoCompleteSource.ListItems; oComboBox.SelectionChangeCommitted += new EventHandler (comboBox_SelectionChangeCommitted); // Create a form. Form oForm = new Form(); oForm.Size = new Size (200, 150); oForm.Controls.Add (oLabel); oForm.Controls.Add (oComboBox); // Run this form. Application.Run (oForm); } static void comboBox_SelectionChangeCommitted (object sender, EventArgs e) { MessageBox.Show ("SelectionChangeCommitted"); } } Click in the text portion of the combo-box and type "A". You will get a list of autocomplete suggestions. Click one of the selections with your mouse. The SelectionChangeCommitted event doesn't happen! Sel
Tags (comma-separated)
Save Edits
Cancel