简体   繁体   中英

C# Winforms GridView ComboBox Column SelectedItemIndex

How can I select a specific value in the combobox column in the datagridView using its index?

Ie the comboboxColumn is already populated. I just need to set its selectedIndex to my choice (if it is possible).

假设您有一个dataGridView带有1列(您的comboboxColumn),并且您想要将cell(0,0)值设置为索引2:

dataGridView1.Rows[0].Cells[0].Value = comboboxColumn.Items[2];

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