T
tshad
I am getting this error trying to dynamically added a column to my DataGrid.
I have the following code:
Function CreateBoundColumn(c as DataColumn) as DataGridColumn
Dim column as DataGridColumn = new BoundColumn()
column.DataField = c.ColumnName <----
the error
column.HeaderText = c.ColumnName.Replace("_"," ")
column.DataFormatString =setFormating(c)
return column
End Function
But the code I borrrowed this from was:
'add bound columns to the datagrid
Dim datagridcol As New BoundColumn
datagridcol.HeaderText = "Candy Type"
datagridcol.DataField = "CandyType"
DataGrid1.Columns.Add(datagridcol)
Here they use DataField the same as I do.
Am I missing something to make this work?
Thanks,
Tom
I have the following code:
Function CreateBoundColumn(c as DataColumn) as DataGridColumn
Dim column as DataGridColumn = new BoundColumn()
column.DataField = c.ColumnName <----
the error
column.HeaderText = c.ColumnName.Replace("_"," ")
column.DataFormatString =setFormating(c)
return column
End Function
But the code I borrrowed this from was:
'add bound columns to the datagrid
Dim datagridcol As New BoundColumn
datagridcol.HeaderText = "Candy Type"
datagridcol.DataField = "CandyType"
DataGrid1.Columns.Add(datagridcol)
Here they use DataField the same as I do.
Am I missing something to make this work?
Thanks,
Tom