Events may be fired when you aren't expecting them.
For example, you expect the Selected Index Changed event of a Combo Box to fire when the user changes the currently selected item. NET forms engine may also fire the event when you are simply setting it up for databinding.
The following code snippet sets location, width, height, background color, foreground color, Text, Name, and Font properties of a Combo Box. Add method that adds Combo Box control to the Form controls and displays on the Form based on the location and size of the control.
Once the Combo Box control is ready with its properties, the next step is to add the Combo Box to a Form. The following code snippet adds a Combo Box control to the current Form.
Data Source property is used to get and set a data source to a Combo Box.
The data source can be a collection or object that implements IList interface such as an array, a collection, or a Data Set.
If the focus moves away from a Combo Box, the value of Selected Text will be an empty string.
To get current text in a Combo Box when it does not have focus, use Text property.
By using these features, we can build Google search like auto completion functionality in our Windows Forms applications.
The Auto Complete Source and Auto Complete Mode properties of the Text Box and Combo Box controls allow developers to provide automatic completion text feature.
We can also use Width and Height property instead of Size property.