DataGridView-----datagridviewcomboboxcolumn

In today's project, we need to implement a drop-down box to display data. At the same time, we need to perform corresponding data binding and saving. The following are two common ways.

1. Bind database data source

2. Directly input list collection.

3. Problems that arise

Problem: When using datagridviewcomboboxcolumn, by default the background color of the first drop-down box clicked in the current row is black for the first time and when the mouse is clicked on the current row.

solution: Compatibility issue. Since one uses dontbar and the other uses winfrom

Attributes effect
DataPropertyName Implementing data binding allows combobox to find the modified data and bind it directly to the corresponding attribute value. Can be used in association with DataBoundItem of data row.

Guess you like

Origin blog.csdn.net/VS18703761631/article/details/127067872