473,587 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is this a bug, or do I something Wrong with SelectionChange Committed?

Cor
Hi all,

I think I do something wrong, but I don't see what.
I have made a sample.
The sample needs only a form with a combobox and this code.
(I can tell you that it took a long time to see this, but it still can be
that I do something stupid).

When I fill a combobox (1) direct, I get after SelectionChange Committed the
previous selected item.
When I fill a combobox (2) using a datatable I get after
SelectionChange Committed the selected item (The behaviour that I suspected).

This is the text on MSDN about it,
Occurs when the selected item has changed and that change is committed.

Remarks
You can create a SelectionChange Committed event handler to provide special
handling for the ComboBox when the user changes the selected item in the
list.
(That did me doubt if I understood it well).

I am curious if I become crazy?
(I could find nothing about it on MSDN).

Cor

\\\\
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim i As Integer
For i = 10 To 100 Step 10
Me.ComboBox1.It ems.Add(i.ToStr ing)
Next
Me.ComboBox1.Se lectedIndex = 5
Dim dt As New DataTable
Dim dc As New DataColumn
Dim dr As DataRow
dc.DataType = System.Type.Get Type("System.St ring")
dc.ColumnName = "i"
dt.Columns.Add( dc)
For i = 1 To 10
dr = dt.NewRow()
dr("i") = (i * 10).ToString
dt.Rows.Add(dr)
Next i
Me.ComboBox2.Di splayMember = "i"
Me.ComboBox2.Da taSource = dt
Me.ComboBox2.Se lectedIndex = 5
End Sub
Private Sub ComboBox1_Selec tionChangeCommi tted _
(ByVal sender As Object, ByVal e As System.EventArg s) Handles _
ComboBox1.Selec tionChangeCommi tted
MessageBox.Show (Me.ComboBox1.T ext)
End Sub
Private Sub ComboBox2_Selec tionChangeCommi tted _
(ByVal sender As Object, ByVal e As System.EventArg s) Handles _
ComboBox2.Selec tionChangeCommi tted
MessageBox.Show (Me.ComboBox2.T ext)
End Sub
///
Nov 20 '05 #1
3 2777
Cor
> The sample needs only a form with a combobox and this code.
2 comboboxes
Nov 20 '05 #2
Hi Cor
That is strange.
I edited your code to this
*************** *********
Private Sub ComboBox1_Selec tionChangeCommi tted(ByVal sender As Object, ByVal
e As System.EventArg s) Handles ComboBox1.Selec tionChangeCommi tted

MessageBox.Show ("Cbo1 - Change Committed:" & Me.ComboBox1.Te xt)

End Sub

Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As Object, ByVal e
As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged

MessageBox.Show ("Cbo1 - Index changed: " & Me.ComboBox1.Te xt)

End Sub

Private Sub ComboBox2_Selec tionChangeCommi tted(ByVal sender As Object, ByVal
e As System.EventArg s) Handles ComboBox2.Selec tionChangeCommi tted

MessageBox.Show ("Cbo2 - Change Committed: " & Me.ComboBox2.Te xt)

End Sub

Private Sub ComboBox2_Selec tedIndexChanged (ByVal sender As Object, ByVal e
As System.EventArg s) Handles ComboBox2.Selec tedIndexChanged

MessageBox.Show ("Cbo2 - Index changed: " & Me.ComboBox2.Te xt)

End Sub

*************** *************** ****

And it seems (like you said) that the ChangeCommitted event appears before
the value actually changes when the combo is filled directly. But it works
well if you use datarows (like you said)

Then I looked in the code and the only difference I could tell was the
..Displaymember so I tried this (Just a guess)

*************** ******

Me.ComboBox1.Di splayMember = Me.ComboBox1.It ems(0)

*************** *******

And then it worked fine

I am puzzled

Jan


"Cor" <no*@non.com> skrev i en meddelelse
news:uW******** ******@TK2MSFTN GP11.phx.gbl...
The sample needs only a form with a combobox and this code.

2 comboboxes

Nov 20 '05 #3
Cor
Hi Jan,

This is a nice workaround yes.
*************** ******

Me.ComboBox1.Di splayMember = Me.ComboBox1.It ems(0)

*************** *******

I did make datatables instead.

I think I bring it back again to this.

Cor
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
344
by: Supa Hoopsa | last post by:
I have a standard combo box in a datagrid (DataGridEnableComboBoxColumn) and I want to catch the SelectionChangeCommitted event. Does anyone know how to do this?
6
6563
by: Michael Sparks | last post by:
Hi, I suspect this is a bug with AMK's Crypto package from http://www.amk.ca/python/code/crypto , but want to check to see if I'm being dumb before posting a bug report. I'm looking at using this library and to familiarise myself writing small tests with each of the ciphers. When I hit Crypto.Cipher.ARC4 I've
0
2560
by: Shravan | last post by:
Hi, There is a bug in combobox selectionchangecommitted event firing, I took a combobox of style dropdownlist, I dropped down it using mouse and using Alt+Up Arrow key closed the dropdown, initially the selectedindex was -1 and after closing up the selectedindex was -1, but the combobox is raising selectionchangecommitted event which should...
1
3365
by: Kalvin | last post by:
I have a combobox, when I use the mouse and click an item, then the SelectionChangeCommitted event fires. However, if I use the arrow keys and move up or down the list to a new item, then this event doesn't fire. Is there a way to capture it either way. Or, is this what the lost focus event is for? Kalvin
3
2889
by: SH | last post by:
Why doesn't the SelectionChangeCommitted event fire when the user chooses an item via the keyboard and then presses the return key or the tab key? I have a combobox with AutoCompleteSource=ListItems and AutoCompleteMode=SuggestAppend. When the user makes a selection via the mouse, the SelectionChangeCommitted event fires. Good. But when...
5
6800
by: docw | last post by:
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.
11
2340
by: matsi.inc | last post by:
I am looking to make something like a delegate that i can use in my projects but am having a hard time getting started. The behavior I am most interested in is how a delegate changes it's Invoke method dynamically to match the arguments supplied to it when it is defined. For example... public delegate void MyDelegate(string myString,...
5
2904
by: Simon Brooke | last post by:
This is supposed to be a very simple XSL stylesheet to strip styling information out of HTML documents - it could not be more basic. And yet, it doesn't work. I'm obviously getting something very basic wrong and for the life of me I can't see it. Please, somebody, cast your eyes over this and tell me what's wrong! First, the XSL stylesheet:...
34
1757
by: raphfrk | last post by:
This program should copy one file onto the other. It works if I compile it with gcc to a cygwin program. However, if I compile it with the -mno-cygwin option, it doesn't work (this targets native windows). Anyway, I just want to check that the program is valid before I see if I can find a way around a compiler bug. It might be...
0
7918
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5713
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3875
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2353
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.