注册 登录
编程论坛 VB.NET论坛

菜鸟[求助]关于datagrid中首列增加checkbox的问题

alex_guo 发布于 2006-06-23 17:33, 1683 次点击
我刚接触vb.net,所以有很多地方还不是很明白,请各位高手多指教,谢谢
我在窗体中添加了datagrid控件,并已经与数据库邦定,但我想在自定义的列前添加一列checkbox可以对数据进行筛选
我在datagrid的tablestyles属性中添加了datagridboolcolumn,可没有显示出来,请问如何实现,谢谢。
目前我只需要显示,并不一定要做具体操作,所以对各位高手来说应该很简单,请教教小弟,急盼回复
4 回复
#2
偷吃狼的羊2006-07-07 18:04
mappingname
#3
论坛元老2008-04-02 18:18
不错,值得学习
#4
fairy42008-04-03 11:15
Private colBoolStyle As DataGridBoolColumn   
   Private stydgFailStatist As DataGridTableStyle
   Private  styTextCol As DataGridTextBoxColumn

         colBoolStyle = New DataGridBoolColumn
        colBoolStyle.Alignment = HorizontalAlignment.Center
        colBoolStyle.HeaderText = "維修標記"
        colBoolStyle.MappingName = "RepairResult"
        colBoolStyle.NullText = ""
        colBoolStyle.ReadOnly = False
        colBoolStyle.Width = 60
        stydgFailStatist.GridColumnStyles.Add(colBoolStyle)

        styTextCol = New DataGridTextBoxColumn
        styTextCol.Alignment = HorizontalAlignment.Left
        styTextCol.HeaderText = "數量"
        styTextCol.MappingName = "FailCount"
        styTextCol.NullText = ""
        styTextCol.ReadOnly = False
        styTextCol.Width = 60
        stydgFailStatist.GridColumnStyles.Add(styTextCol)

        stydgFailStatist.AllowSorting = False
        stydgFailStatist.MappingName = "DataList"
        stydgFailStatist.BackColor = System.Drawing.Color.FromArgb(242, 255, 242)
        stydgFailStatist.PreferredRowHeight = 15
        stydgFailStatist.ReadOnly = False
        stydgFailStatist.RowHeaderWidth = 10

        datagrid1.TableStyles.Add(stydgFailStatist)
        datagrid1.ReadOnly = False
       自己定義datagrid的風格!想怎樣就怎樣
#5
laohuang2008-05-01 23:06
回复 1# 的帖子
恩.我也不会,值得学习..
楼主要是学会 了.别忘记教我.
1