如何显示在winform为的DataGridViewComboBoxCell值设为默认值? [英] How to show set default value for DataGridViewComboBoxCell Value in winform?
本文介绍了如何显示在winform为的DataGridViewComboBoxCell值设为默认值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 DataGridView的
有一个 DataGridViewComboBoxColumn
,我已经填充的组合框,但之后明确表示, DataGridView的
我必须设置一个默认值的组合框所以,请帮助我。
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屋!
查看全文