如何在 winform 中显示 DataGridViewComboBoxCell 值的设置默认值? [英] How to show set default value for DataGridViewComboBoxCell Value in winform?
本文介绍了如何在 winform 中显示 DataGridViewComboBoxCell 值的设置默认值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 DataGridView
有一个 DataGridViewComboBoxColumn
并且我已经填充了那个 ComboBox 但是在清除 DataGridView
之后我必须设置一个默认值那个 ComboBox 所以请帮帮我.
I have a DataGridView
having one DataGridViewComboBoxColumn
and I have populated that ComboBox but after clear that DataGridView
I have to set one default value for that ComboBox So please help me out.
推荐答案
你可以在CellFormatting
事件
void dataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex == 0) //Index of your DataGridViewComboBoxColumn
{
e.Value = "Default Value";
}
}
这篇关于如何在 winform 中显示 DataGridViewComboBoxCell 值的设置默认值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文