Add text columns to briskdatagrid
To add a datagridtextcolumn to the briskdatagrid, you must use the addtextcolumn () method of the briskdatagrid. The method is prototype as follows:
Public sub addtextcolumn (_
Byval textcolumn as datagridtextcolumn ,_
Byval mappingname as string ,_
Optional byval headertext as string = "",_
Optional byval [readonly] as Boolean = false ,_
Optional byval alignment as horizontalalignment = horizontalalignment. Center ,_
Optional byval nulltext as string = "",_
Optional byval width as integer = 75)
Textcolumn |
This parameter requires a datagridtextcolum class object, which will be added to the briskdatagrid table style. |
Mappingname |
This parameter is used to map columns to data member names. This parameter is used to accept a string. |
Headertext |
This parameter accepts a string used to set the header text. This parameter is an optional parameter. The default value is "". |
Readonly |
This parameter accepts a Boolean value indicating whether the column is read-only. True, read-only; false, not read-only. This parameter is an optional parameter. The default value is false. |
Alignment |
This parameter is used to set the text alignment in cells. This parameter is optional and the default value is horizontalalignment. Center. |
Nulltext |
This parameter is used to set the text displayed when the column contains a null reference. Optional parameter default value "". |
Width |
Set the column width. Optional. The default value is 75. |
The following program snippet shows how to add the datagridtextcolumn to the briskdatagrid:
Private sub initbriskdatagrid ()
Dim dvemployee as new dataview (Me. dshr. Tables ("employees "))
Me. briskdatagrid. setdatabinding (dvemployee)
Me. briskdatagrid. begintablestyle ("employees ")
Dim colemployeename as datagridtextcolumn
Me. briskdatagrid. addtextcolumn (colemployeename, "emp_name", "employee name ")
Me. briskdatagrid. endtablestyle ()
End sub