DataGrid Formatting

Newbie_71

New member
Joined
Jun 22, 2005
Messages
3
Programming Experience
Beginner
Hello Forum,

This is my first time posting here. I was hoping someone here might be able to help me with a problem that I can't find the solution to.

I made a collection of objects named OBJ_Collection. I can bind it to a DataGrid with the following statement:

DataGrid1.DataSource = OBJ_Collection.

It displays the collection in the grid. However, when I try the following code it does nothing. It does not give any error or warning, it simply does nothing.

Dim grdStyle As New DataGridTableStyle()
Dim grdCol1 As New DataGridTextBoxColumn()
grdCol1.Headertext = "Heading 1"
grdStyle.GridColumnStyles.Add(grdCol1)
Dim grdCol2 As New DataGridTextBoxColumn()
grdCol2.HeaderText = "Heading 2"
grdStyle.GridColumnStyles.Add(grdCol2)
DataGrid1.TableStyles.Add(grdStyle)

It works when I use a DataTable from a DataSet, except doesn't work with a collection of objects. Does anyone here know why this might be?
 
Back
Top