break

C#:ComboBoxColumn default value

Today I’ve been wondering how to set a DataGridViewComboBoxColumn to a default value. The reason I wanted do this, is because i want the combo box to have a default value when the datagridview is loaded in the screen.

The line to accomplish this is the following:

DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn();
cmb.DefaultCellStyle.NullValue = "Buy";

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.