c# - DataGridView DataBinding get selected object from Combobox -


i have datagridview, 1 of column combobox (datagridviewcomboboxcolumn) binded property of objects. datagridview format cell calls tostring() of objects. combo list strings , try select combobox error because program trying set string object. how solve it? select combobox object value not string.

i have collection of objects (myobject) contains property

public reason kind { get; set; } 

reason has method tostring() datagridview calls automaticly. while select value combobox not reason object, string

you need use displaymemberpath property on datagridviewcomboboxcolumn

<datagridviewcomboboxcolumn displaymemberpath="propertyname" /> 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -