简体   繁体   中英

C# make combobox items remember datagridview.cell.value and datagridview.row of that cell

I have a Datagridview and 18 comboboxes.Each combobox represents a column of the Datagridview.

The point is: when I select a combobox item in the dropdownlist, I'd like the other comboboxes to select the corresponding item. I believe that to do that I have to make the comboboxes remember the row of the item.

At first I tried to make a specific class for it but I'm having some trouble. Then thought that I could store the row information into the combobox by putting it into value property. But I'm still having troubles.

Keeping in mind that trouble won't ever completely leave me, someone has any tips?

Thank you all so much.

I would try this: use the SelectIndexChanged on the first combobox and get the line index, after that, change the others combobox index by setting them with the index you found. This is the dumbest approach, then you can improve it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM