Reputation: 37
I'm trying to swap columns 1&2 with columns 6&7 for display. This is the code I have but it doesn't work?
dgvListings.Columns(1).DisplayIndex = 6
dgvListings.Columns(2).DisplayIndex = 7
dgvListings.Columns(6).DisplayIndex = 1
dgvListings.Columns(7).DisplayIndex = 2
Upvotes: 0
Views: 4805
Reputation: 1498
You need to set the property
dgvListings.AutoGenerateColumns = false;
prior to setting the column order.
Upvotes: 1