|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ComboBox SelectionChangeCommitted event fires twiceHi, Please have a look at the following ComboBox behavior. With the code below, if you click in the dropdown list with the mouse to select an item , everything is fine. But if you use the Enter key to select in the dropdown list, the SelectionChangeCommitted event is fired twice. How can I cancel the second event firing ? Thanks ML '#### BEGIN CODE ################## Private Sub FormTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList ComboBox1.Items.Add("My item 1") ComboBox1.Items.Add("My item 2") ComboBox1.Items.Add("My item 3") End Sub Private Sub ComboBox1_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectionChangeCommitted MsgBox("test") End Sub '#### END CODE ################## Hi ML,
I have tested it with VS2005. This code does not show the problem you report (?). -tom d***@globetrotter.net ha scritto: Show quoteHide quote > SelectionChangeCommitted event fires twice > > Hi, > > Please have a look at the following ComboBox behavior. > With the code below, if you click in the dropdown list with the mouse > to select an item , everything is fine. > > But if you use the Enter key to select in the dropdown list, the > SelectionChangeCommitted event is fired twice. > > How can I cancel the second event firing ? > > Thanks > ML > '#### BEGIN CODE ################## > > Private Sub FormTest_Load(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Load > ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList > > ComboBox1.Items.Add("My item 1") > ComboBox1.Items.Add("My item 2") > ComboBox1.Items.Add("My item 3") > End Sub > > Private Sub ComboBox1_SelectionChangeCommitted(ByVal sender As > Object, ByVal e As System.EventArgs) Handles > ComboBox1.SelectionChangeCommitted > > MsgBox("test") > > End Sub > > '#### END CODE ################## Hi Tom,
Sorry I did not specify that I'm using VS .Net 2003. tommaso.gasta***@uniroma1.it wrote: Show quoteHide quote > Hi ML, > I have tested it with VS2005. This code does not show the problem you > report (?). > > -tom > > d***@globetrotter.net ha scritto: > > > SelectionChangeCommitted event fires twice > > > > Hi, > > > > Please have a look at the following ComboBox behavior. > > With the code below, if you click in the dropdown list with the mouse > > to select an item , everything is fine. > > > > But if you use the Enter key to select in the dropdown list, the > > SelectionChangeCommitted event is fired twice. > > > > How can I cancel the second event firing ? > > > > Thanks > > ML > > '#### BEGIN CODE ################## > > > > Private Sub FormTest_Load(ByVal sender As System.Object, ByVal e As > > System.EventArgs) Handles MyBase.Load > > ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList > > > > ComboBox1.Items.Add("My item 1") > > ComboBox1.Items.Add("My item 2") > > ComboBox1.Items.Add("My item 3") > > End Sub > > > > Private Sub ComboBox1_SelectionChangeCommitted(ByVal sender As > > Object, ByVal e As System.EventArgs) Handles > > ComboBox1.SelectionChangeCommitted > > > > MsgBox("test") > > > > End Sub > > > > '#### END CODE ################## ML,
In addition to Tommasso, I did not test it, but found it curious that you would get an error with this code. Are you sure that the error is not because that you are selecting inside the event? Cor <d***@globetrotter.net> schreef in bericht Show quoteHide quote news:1153324853.715505.123240@m79g2000cwm.googlegroups.com... > SelectionChangeCommitted event fires twice > > Hi, > > Please have a look at the following ComboBox behavior. > With the code below, if you click in the dropdown list with the mouse > to select an item , everything is fine. > > But if you use the Enter key to select in the dropdown list, the > SelectionChangeCommitted event is fired twice. > > How can I cancel the second event firing ? > > Thanks > ML > '#### BEGIN CODE ################## > > Private Sub FormTest_Load(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Load > ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList > > ComboBox1.Items.Add("My item 1") > ComboBox1.Items.Add("My item 2") > ComboBox1.Items.Add("My item 3") > End Sub > > Private Sub ComboBox1_SelectionChangeCommitted(ByVal sender As > Object, ByVal e As System.EventArgs) Handles > ComboBox1.SelectionChangeCommitted > > MsgBox("test") > > End Sub > > '#### END CODE ################## > d***@globetrotter.net wrote:
> SelectionChangeCommitted event fires twice Reproduced in 2003 - thanks for the complete sample.> > Hi, > > Please have a look at the following ComboBox behavior. > With the code below, if you click in the dropdown list with the mouse > to select an item , everything is fine. > > But if you use the Enter key to select in the dropdown list, the > SelectionChangeCommitted event is fired twice. > > How can I cancel the second event firing ? I think your options are: - upgrade (I know this probably isn't an available option) - rework your app so that it isn't a problem that this event fires twice in these circumstances - how about you only do whatever you want to do on selection change if the selection *actually changes* - ie, keep a separate track of what the current selection is, and if you get a SelectionChangeCommitted but the new selection is the same as the current stored selection, don't do anything. -- Larry Lard larryl***@googlemail.com The address is real, but unread - please reply to the group For VB and C# questions - tell us which version Docw,
I call the combobox for myself always the bugbox. By the way, you know that there is a servicepack for Net 1.1, I don't know if your problem is fixed in that. http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=262d25e3-f589-4842-8157-034d1e7cf3a3 Cor <d***@globetrotter.net> schreef in bericht Show quoteHide quote news:1153324853.715505.123240@m79g2000cwm.googlegroups.com... > SelectionChangeCommitted event fires twice > > Hi, > > Please have a look at the following ComboBox behavior. > With the code below, if you click in the dropdown list with the mouse > to select an item , everything is fine. > > But if you use the Enter key to select in the dropdown list, the > SelectionChangeCommitted event is fired twice. > > How can I cancel the second event firing ? > > Thanks > ML > '#### BEGIN CODE ################## > > Private Sub FormTest_Load(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Load > ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList > > ComboBox1.Items.Add("My item 1") > ComboBox1.Items.Add("My item 2") > ComboBox1.Items.Add("My item 3") > End Sub > > Private Sub ComboBox1_SelectionChangeCommitted(ByVal sender As > Object, ByVal e As System.EventArgs) Handles > ComboBox1.SelectionChangeCommitted > > MsgBox("test") > > End Sub > > '#### END CODE ################## >
Argument not specified
check database connection/open Default date Combining datatables Access Databse "Select * from Bilag Where Mdates Between #1/1/2006# And #31/1/2006#" Create Recordset from a non standard data source Crystal Reports and Data Tables. TreeView Nodes and Icons clickonce xml data file Property: ReadOnly on public scope while Read-Write on friend or private scope |
|||||||||||||||||||||||