Hi Orlando,
Try to create a DataGridTableStyle, set its MappingName to "AB" (or leave it
empty - I really don't remember how to set MappingName properly when binding
it to a collection). Then, create two instances of DataGridColumnStyle and
set their mapping names to "AA" and "AC" (or, maybe, "AB.AA" and "AB.AC").
All these preparations should take place before calling the SetDataBinding
method on the grid.
P.S. The table styles and the column style can be created visually with the
TableStyles collection designer and the GridColumnStyles collection
designer.
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"Orlando Cavadini" <(E-Mail Removed)> wrote in message
news:3f7c40f9$0$240$(E-Mail Removed)...
> Hello
>
> I bind a collection of objects with Type AB (Class AB) to a DataGrid
control
> as following:
>
> Public Class AB
> Private m_AA As Integer
> Private m_AB As Integer
> Private m_AC As Integer
>
> Public Property AA() As Integer
> Get
> Return m_AA
> End Get
> Set(ByVal Value As Integer)
> m_AA = Value
> End Set
> End Property
>
> Public Property AB() As Integer
> Get
> Return m_AB
> End Get
> Set(ByVal Value As Integer)
> m_AB = Value
> End Set
> End Property
>
> Public Property AC() As Integer
> Get
> Return m_AC
> End Get
> Set(ByVal Value As Integer)
> m_AC = Value
> End Set
> End Property
> End Class
> ...
>
> Private m_list As New Collection
> ...
>
> Dim c As AB
> c = New AB
> c.AA = 9
> c.AB = 99
> c.AC = 999
> m_list.Add(c)
> c = New AB
> c.AA = 8
> c.AB = 88
> c.AC = 888
> m_list.Add(c)
>
> ...
>
> DataGridSections.DataSource = m_list
>
> The DataGrid shows three columns AA, AB, AC with two rows of data. That
> works fine. But now, i'd like to show only the columns AB and AC. What do
I
> have to do to get this result. Everything I tried failed.
>
> Many Thanks for your help in advance
>
> Orlando
>
>