This tip demonstrates how to optimize code behind DataBound controls in .NET
But first we need to set the DataSource property after setting the ValueMember, DisplayMember of DataBound controls such as ComboBox, LookupEdit, ListBox.
Otherwise the control will repopulate as the ValueMember changes.
Example in VB.Net:
components used :
cboClientName is the combobox
clientDataTable is a DataTable
So we should write in following manner for efficiency :