Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to display text in DataGridViewComboBoxColumn when the databound value is null
- //attach in code or via designer:
- dataGridView1.CellFormatting += new DataGridViewCellFormattingEventHandler(dataGridView1_CellFormatting);
- //example implementation:
- void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
- {
- if (e.ColumnIndex == Column1.Index && e.Value==null)//where Column1 is your combobox column
- {
- e.Value = "Empty";
- e.FormattingApplied = true;
- }
- }
Add Comment
Please, Sign In to add comment