cbSalesman.SelectedValue = salesman;
This is probably because you would need to give it not just a string to look for, but an actual object that is a member of the Items list. That would require ugly gyrations along the lines of the following.- get the string to look for
- get the index of that string in the dropdown (using Items.IndexOf)
- grab the item at that index
- feed it to the "SelectedValue" property.
cbSalesman.SelectedIndex = cbSalesman.Items.IndexOf(salesman);
...
Bryan Valencia is a contributing editor and founder of Visual Studio Journey. He owns and operates Software Services, a web design and hosting company in Manteca, California.
No comments:
Post a Comment