I\'m trying to add N number of columns for each days of a given month:
var daysCount = DateTime.DaysInMonth(DateTime.Now.Year, month); for (int i = 1; i <= d
You need to specify first whether it's a textbox column or combobox column Try this it will work
var daysCount = DateTime.DaysInMonth(DateTime.Now.Year, month); for (int i = 1; i <= daysCount; i++) { dataGridView1.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = i.ToString() }); }