Blog Image

Software Development

About the blog

The blog was created in an attempt to keep those valued points which are discovered in daily development and give something back to the community.

DataGridView.AutoGenerateColumns

Databinding Posted on 2010-05-02 11:11

If the DataGridView seems unwilling to change the column-order even when specifically ordered to, then the reason is probably that AutoGenerateColumns is set to true.

The symptoms are not very consistent, because it will seem like it’s possible to move some columns but not others, which may lead one into a wild goose-chase for the reason why the particular column that one is trying to position can’t be positioned exactly where one wants.



DataGridView.AllowUserToAddRows

Databinding Posted on 2010-05-02 11:04

AllowUserToAddRows needs the DataSource to support IBindingList with AllowNew set to true.

So either normalize the data to a BindingList instance which is then used as the DataSource or support IBindingList on the collection which is used as DataSource.