I have a combobox for an item list that I populate using the following code:
List<string> comboboxItems = new List<string>();
foreach (var p in products)
{
var x = p.Product;
foreach (var pn in x)
{
comboboxItems.Add(pn.name + " :Qty " + pn.quantity_available
+ " :Tax " + pn.default_tax_tier);
}
}
cmbItems.DataSource = comboboxItems;
What should I do in order to get the value, pn.name only when the combobox item is selected?
Using WinForms.
You have to handle the event
DataGridView.EditingControlShowing
event, in there you can access the actual combobox and register theSelectedIndexChanged
event handler like this: