How do I programmatically select a Combo or ListBox item?
You can programmatically select an item in a ComboBox or ListBox by setting its SelectedIndex property.
For example, in C#:
this.lstEmployees.SelectedIndex = 1;And in VB .NET:
Me.lstEmployees.SelectedIndex = 1If you don't know the index number of the item you want to select, but you know it's text display value, you can use the FindString or FindExactString method to find the item index.
For example, in C#:
this.lstEmployees.SelectedIndex = this.lstEmployees.FindExactString(SelectedText);And in VB .NET:
Me.lstEmployees.SelectedIndex = Me.lstEmployees.FindExactString(SelectedText)
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 08/12/09
Comment or report problem with topic
