简体   繁体   English

C#Winforms GridView组合框列SelectedItemIndex

[英]C# Winforms GridView ComboBox Column SelectedItemIndex

How can I select a specific value in the combobox column in the datagridView using its index? 如何使用datagridView的索引在组合框列中选择一个特定值?

Ie the comboboxColumn is already populated. 即,comboboxColumn已被填充。 I just need to set its selectedIndex to my choice (if it is possible). 我只需要将其selectedIndex设置为我的选择(如果可能)。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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