Strange Problem with ArrayList bound to Datagridview

V

Vic

I have a strange problem, and hope that somebody cane help me to find the
solution.

I bound a Arraylist with objects to a Datagridview (via the Datasource).

The class of the objects have 3 public properties by which the datagrid have
3 columns, but the problem is that de columns in the datagrid are not in the
same sequence as the properties in the class definition. For instance is
the properties are P1, P2 and P3 and defined in that order in the class, the
columns in the datagridview are (from left to right) P3, P1 and P2 And the
most strange is that it must be a problem on my pc or the Vb2005 (Sp1) on
that pc (OS= Vista Home Premium). Because if a run the same, (small example)
project on a other pc there the columns are showing correct.

Is there anybody who recognizes this problem and cane help me?



Best Regards Vic
 
M

Michael C

Vic said:
I have a strange problem, and hope that somebody cane help me to find the
solution.

I bound a Arraylist with objects to a Datagridview (via the Datasource).

The class of the objects have 3 public properties by which the datagrid
have 3 columns, but the problem is that de columns in the datagrid are not
in the same sequence as the properties in the class definition. For
instance is the properties are P1, P2 and P3 and defined in that order in
the class, the columns in the datagridview are (from left to right) P3, P1
and P2 And the most strange is that it must be a problem on my pc or the
Vb2005 (Sp1) on that pc (OS= Vista Home Premium). Because if a run the
same, (small example) project on a other pc there the columns are showing
correct.

Is there anybody who recognizes this problem and cane help me?

Just add the columns in the form designer and set AutoSomethingColumns to
false (I can't remember the exact property name, it's not available at
design time so you'll need to set it in OnLoad). You will need to set which
property each column binds to with another property I can't remember the
name of but that one is there is the designer.
 
V

Vic

Michael, Thx for this replay.

Ok I now that normally you add columns and map the column to the correct
property.
But what i'an wondering is why wihtout mapping only pc with Vista are doing
this?

Vic
 
M

Michael C

Vic said:
Michael, Thx for this replay.

Ok I now that normally you add columns and map the column to the correct
property.
But what i'an wondering is why wihtout mapping only pc with Vista are
doing this?

I have no idea but I guess there is nothing to set the column order in
stone. Maybe you need to set an attribute on each property to specify the
order?

Michael
 

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