Category / Section
How to synchronize the ComboBox item selection with the WinForms GridListControl?
2 mins read
The selected ComboBox value can be synchronized with the WinForms GridListControl by setting the SelectedIndex property of GridListControl based on the ComboBox selection in SelectedIndexChanged event of ComboBox.
C#
//Triggering the event
this.comboBoxAdv1.SelectedIndexChanged += new EventHandler(comboBoxAdv1_SelectedIndexChanged);
//Event Customization
void comboBoxAdv1_SelectedIndexChanged(object sender, EventArgs e)
{
//Set the SelectedIndex property of GridListControl.
this.gridListControl2.SelectedIndex = this.comboBoxAdv1.SelectedIndex;
}
VB
'Triggering the event
AddHandler comboBoxAdv1.SelectedIndexChanged, AddressOf comboBoxAdv1_SelectedIndexChanged
'Event Customization
Private Sub comboBoxAdv1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
'Set the SelectedIndex property of GridListControl.
Me.gridListControl2.SelectedIndex = Me.comboBoxAdv1.SelectedIndex
End Sub
Synchronize the selected ComboBox value
with the GridListControl as shown below
Samples: