向BriskDataGrid添加列
来源:互联网 发布:windows xp pe 编辑:程序博客网 时间:2024/04/30 02:29
向BriskDataGrid添加列
出于各种各样的原因,需要往BriskDataGrid里添加列。需要注意的是,在添加列之前必须先调用BriskDataGrid.BeginTableStyle()方法。该方法唯一的参数MappingName要求传递映射表的表名。如下例中,BriskDataGrid要显示的是数据集中的employees表的数据,那么就应该传递字符串”employees”。同样不能忘记,当添加列之后必须调用BriskDataGrid.EndTableStyle()方法。如果在调用此方法之前没有调用BriskDataGrid.BeginTableStyle()方法,就会抛除异常NullReferenceException。
以下程序向BriskDataGrid添加了多个列:
Private Sub InitBriskDataGrid()
Dim dvEmployee As New DataView(Me.dsHR.Tables("employees"))
Me.BriskDataGrid.SetDataBinding(dvEmployee)
Me.BriskDataGrid.BeginTableStyle("employees")
Dim colEmpId As DataGridTextColumn
Me.BriskDataGrid.AddTextColumn(colEmpId, "emp_id", "雇员编号")
Dim colEmpName As DataGridTextColumn
Me.BriskDataGrid.AddTextColumn(colEmpName, "emp_name", "雇员姓名")
Dim colEmpSex As New DataGridSexBoxColumn
Me.BriskDataGrid.AddSexBoxColumn(colEmpSex, "emp_sex", "雇员性别")
Dim colEmpAge As DataGridTextColumn
Me.BriskDataGrid.AddTextColumn(colEmpAge, "emp_age", "雇员年龄")
Dim colEmpDepartment As DataGridComboBoxColumn
Me.BriskDataGrid.AddComboBoxColumn(colEmpDepartment, Me.dsHR.Tables("departments"), "dept_id", "dept_name", "emp_department", "所在部门")
Dim colBirth As DataGridDateTimePickerColumn
Me.BriskDataGrid.AddDateTimePickerColumn(colBirth, "emp_dateofbirth", "雇员生日")
Dim colSingle As New DataGridCheckBoxColumn
Me.BriskDataGrid.AddCheckBoxColumn(colSingle, "emp_single", "是否单身")
Me.BriskDataGrid.EndTableStyle()
End Sub
- 向BriskDataGrid添加列
- 向BriskDataGrid添加CheckBox列
- 向BriskDataGrid添加ComboBox列
- 向BriskDataGrid添加DateTimePicker列
- 向BriskDataGrid添加SexBox列
- 向BriskDataGrid添加Text列
- 向 DataTable 添加一行,列
- 动态向Datagrid中添加列
- JTable中向某一列添加JRadioButton
- 向gridview中添加超级链接列
- excel向列数据中添加前缀
- SQL命令向表中添加列
- 使用 Columns 集合动态向 DataGrid 控件添加列。
- 如何向Listview中的各列添加数据?
- 向现有表添加标识列(IDENTITY)
- 向 PPT 表格中添加行或列
- C# 向ListView中添加多列数据的方法
- BriskDataGrid介绍
- 向BriskDataGrid添加ComboBox列
- c语言中的类型转换
- 向BriskDataGrid添加DateTimePicker列
- 向BriskDataGrid添加SexBox列
- 向BriskDataGrid添加Text列
- 向BriskDataGrid添加列
- 在项目中使用BriskDataGrid
- 第三十届ACM国际大学生程序设计竞赛全程采访 – 感动中国
- 4月5日的午夜记
- 从下午到晚上,诸多不顺
- 机器无软驱,如何在VMware中安装MINIX ?
- JSP开发入门
- 没有天理,没有人性!
- 2006-04-04 炸弹人游戏开发日志