Datagrid with Arraylist
Please give me a solution to customise DataGrid in Windows forms.
My datasource is a class inherited from ArrayList. I had to format the datagrid column's Header Name and Visibility
How to format datagrid with datagridTextStyle class ? What should be mapping name in the above case ?
The code samples found in MSDn web site is not working...
Hope i wil get a solution soon
I have tried Mappingname as ArrayList
but its not working (no errors)
The code that i tried is given below ..is there any other design time properties that i have to set before this code ?
Dim
widTable As New DataGridTableStyle
Dim modelColumn As New DataGridTextBoxColumn
Dim objData As New CSBSalary.BranchData
Dim objBranches As CSBSalary.MyObjects.Branches
objBranches = objData.getBranches(901) ' Returns ArrayList
dgdTest.SetDataBinding(objBranches, "")
widTable.MappingName = "ArrayList"
modelColumn.MappingName = "BranchName"
modelColumn.HeaderText = "Name of Branch"
widTable.GridColumnStyles.Add(modelColumn)
dgdTest.TableStyles.Clear()
dgdTest.TableStyles.Add(widTable)
You need to set the DataGridTableStyle MappingName to the name of the type of your array list.
For instance, if your array list is declared like this:
Public
Class MyArrayList
Inherits System.Collections.ArrayList
End
ClassThen set the MappingName to MyArrayList:widTable.MappingName = "MyArrayList"
Hope this helps.