I have a ComboBox control, I get the data from database and add it to the ComboBox like this:
Now, I get one employee id from the database,I want to the cboEmployee display the name relating the id. I write the code like this(so foolish) :(VB Code:
With cboEmployee Do Until rs.EOF .AddItem rs.Fields("EmployeeName") .ItemData(.NewIndex) = rs.Fields("EmployeeID") rs.MoveNext Loop End With
VB Code:
For intCount = 0 To cboEmployee.ListCount - 1 If cboComboBox.ItemData(intCount) = intItemData Then cboComboBox.ListIndex = intCount Exit For End if Next intCount
Who can help me improve the code, thanks in advance!!!
