DisplayMember Property is not working in DataGridViewComboBoxColumn
Loading
DisplayMember Property is not working in DataGridViewComboBoxColumn
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Darshit KalaigarPosted Mar 10, 2023, 11:42 AM
Hello Jigneshbhai,
Already did in Designing.
Thanks
Jignesh KumarPosted Mar 10, 2023, 11:16 AM
Hello Darshit,
Your are doing right but just missed to add your combobox column to add,
Naimish MakwanaPosted Mar 10, 2023, 10:59 AM
Check this link. It might help you.
https://stackoverflow.com/questions/30384684/cells-show-the-value-member-id-instead-display-member
Darshit KalaigarPosted Mar 10, 2023, 10:53 AM
Hello Naimishbhai,
I already used it but it's not working. & also tried this.
houseNameDataGridViewComboBoxColumn.DataSource = dtGetHouse;
houseNameDataGridViewComboBoxColumn.ValueMember = "HouseID";
houseNameDataGridViewComboBoxColumn.DisplayMember = "HouseName";
houseNameDataGridViewComboBoxColumn.DataPropertyName = "HouseID"
Naimish MakwanaPosted Mar 10, 2023, 10:48 AM
Hello Darshit,
If you are displaying the students' houses in a
DataGridViewComboBoxColumnand it is displaying the ID instead of the name when you select a value, it means that theValueMemberproperty is set to the column in the data source that contains the ID, instead of the column that contains the name.try like below:
Thanks
Naimish Makwana
Darshit KalaigarPosted Mar 10, 2023, 10:37 AM
I am displaying Students House in DataGridView ComboBox Column. So when i m Selecting any of the value, it displays its "id" and not "name".
Thanks
Naimish MakwanaPosted Mar 10, 2023, 9:42 AM
Hello Darshit ,
What error you are getting?
Thanks
Naimish Makwana