65.9K
CodeProject is changing. Read more.
Home

ComboBox with proper SelectedIndexChanged support

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.33/5 (6 votes)

Nov 26, 2004

viewsIcon

34260

downloadIcon

612

Fixes a bug in the standard ComboBox wrt the SelectedIndexChanged event

Introduction

If you use a ComboBox and want to change various other controls whenever a new item is selected in the ComboBox, then one event that should help you is the SelectedIndexChanged event. However if you don't change the item by clicking with the mouse or using up or down arrows, this event doesn't fire. So, inspired by Furty (Divider Panel - A Tutorial on creating a custom Windows Forms control from Start to Toolbox), I've thrown together this replacement. It simply fires the SelectedIndexChanged event whenever the KeyUp event fires.

I know this is not a seminal piece of work, but it might help someone out.