C#的MS Access数据库错误ColumnCount属性不能在数据绑定的DataGridView控件设置 [英] c# ms access database error ColumnCount property cannot be set on a data-bound DataGridView control

查看:393
本文介绍了C#的MS Access数据库错误ColumnCount属性不能在数据绑定的DataGridView控件设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮我知道什么是错我的代码,我卡在这个错误,所以,请帮助我。谢谢



 的InitializeComponent(); 


studentInfoDataGridView.ColumnCount = 6;
studentInfoDataGridView.Columns [0] .Name点=ID;
studentInfoDataGridView.Columns [1] .Name点=名字;
studentInfoDataGridView.Columns [2] .Name点=姓氏;
studentInfoDataGridView.Columns [3] .Name点=课程;
studentInfoDataGridView.Columns [4]请将.Name =StudentSection;
studentInfoDataGridView.Columns [5]请将.Name =StudentNumber;



studentInfoDataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

studentInfoDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
studentInfoDataGridView.MultiSelect = FALSE;


解决方案

您不需要设置列数,只要使用
StudentInfoDataFridView.Columns.Add(无所谓);


Please help me to know whats wrong with my code, I'm stuck on this error, So please help me. thanks

       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;

解决方案

You don't need to set ColumnCount,just use StudentInfoDataFridView.Columns.Add("whatever");

这篇关于C#的MS Access数据库错误ColumnCount属性不能在数据绑定的DataGridView控件设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆