Click here to Skip to main content
13,195,564 members (63,913 online)
Rate this:
Please Sign up or sign in to vote.
See more:
i'm getting user's selected item in SelecttionChangeCommitted method with the selected index of the combobox,but i fond the SelecttionChangeCommitted method will execute before the method SelectedIndexChanged,so i got a incorrect result course of the incorrect index.The SelectedIndexChanged method will execute a few times when binding the datasource and any property else,so i just cann't use the SelectedIndexChanged method,and should i deal with it,what's your idea?Thanks.
Posted 24-Dec-12 16:11pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


As per my understanding from you above comments, I assume that the SelectedIndexChanged event is being fired multiple times while binding the DataSource. Here, you can always apply below condition to stop executing the rest of the code.
if (SelectedIndex > 0)

Also, set the ComboBox's property - DropDownStyle = DropDownList, instead of any other thing.

And for using SelectedIndexChanged vs SelectionChangeCommited, this below link will explain you one of the scenarios where you might get an error.


There will be more differences (check here)[^], but please do let us know if you have any other concerns.

Merry Christmas..!


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171019.1 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100