ArrayList bound to DataGridView

V

Vic

I have a ArrayList bound to a DataGridView.
The objects in de arryalist have 5 propertie but i need only 3 of then in de
datagridview.
Cane somebody tell me how to prevent that some of the properties are not
show.

Best Regards
Vic
 
T

Tom Shelton

I have a ArrayList bound to a DataGridView.
The objects in de arryalist have 5 propertie but i need only 3 of then in de
datagridview.
Cane somebody tell me how to prevent that some of the properties are not
show.

Best Regards
Vic

The only way I know is to turn AutGenerateColumns to false and then add the
columns you want:

myDataGridView.AutoGenerateColunns = False

Dim firstColumn As = new DataGridViewTextBoxColumn()
firstColumn.Name = "First Column"

' the name here is the name of the property of
' the object you want to be bound to this column
firstColumn.DataPropertyName = "MyProperty"

myDataGridView.Columns.Add(firstColumn)

' rinse and repeat until all columns are added.


HTH
 
V

Vic

Thx Tom for this.

Maybe a second question.
To bound a property to a column you indicate firstColumn.DataPropertyName =
"MyProperty"
Is this the only possibility? Isn't possible to use early binding?

Vic
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top