您的位置:程序门 -> .net技术 -> c#



datagrid 中显示表头


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


datagrid 中显示表头
发表于:2007-03-12 15:01:29 楼主
如果datagrid   在form_load的时候自己初始化一个表头(不连接数据库),请问怎么写?
发表于:2007-03-12 16:09:511楼 得分:0
写一个dataset,手动往里面插入一条记录,里面是你的表头信息,然后绑定给datagrid。
发表于:2007-03-12 16:13:352楼 得分:0
this.dtgresult.columncount   =   6;
                        this.dtgresult.columns[0].headertext   =   "序号 ";
                        this.dtgresult.columns[0].readonly   =   true;
                        this.dtgresult.columns[1].headertext   =   "仪表厂家 ";
                        this.dtgresult.columns[1].readonly   =   true;
                        this.dtgresult.columns[2].headertext   =   "仪表系列 ";
                        this.dtgresult.columns[2].readonly   =   true;
                        this.dtgresult.columns[3].headertext   =   "仪表型号 ";
                        this.dtgresult.columns[3].readonly   =   true;
                        this.dtgresult.columns[4].headertext   =   "kks码 ";
                        this.dtgresult.columns[4].readonly   =   true;
                        this.dtgresult.columns[5].headertext   =   "中文描述 ";
                        this.dtgresult.columns[5].readonly   =   true;
要讨论技术问题,请加35813890


快速检索

最新资讯
热门点击