请帮助我知道我的代码有什么问题,我坚持这个错误,所以请帮助我。感谢
InitializeComponent();
studentInfoDataGridView.ColumnCount = 6;
studentInfoDataGridView.Columns[0].Name = "ID";
studentInfoDataGridView.Columns[1].Name = "FirstName";
studentInfoDataGridView.Columns[2].Name = "LastName";
studentInfoDataGridView.Columns[3].Name = "Course";
studentInfoDataGridView.Columns[4].Name = "StudentSection";
studentInfoDataGridView.Columns[5].Name = "StudentNumber";
studentInfoDataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
studentInfoDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
studentInfoDataGridView.MultiSelect = false;
答案 0 :(得分:0)
您不需要设置ColumnCount,只需使用即可 StudentInfoDataFridView.Columns.Add("无论&#34);