jeffc said:
Yeah, that makes sense. It's pretty simple though. I won't show the rest
of the code because so much seems to be working, I don't understand what
could be causing the problem, and the code is simple.
You will get better assistance if you do post a concise-but-complete
code example that reliably reproduces the problem.
What you posted _should_ work, IMHO. And the reply from Chris does
suggest that there may in fact be a bug in the DataGridViewColumn that's
preventing this from working correctly.
But I know that I didn't run into the problem the one time I had to
reorder columns in my own DataGridView, and so to rule out the
possibility that there's something else in your code confounding the
DisplayIndex setting, you should reduce the code to the bare minimum
required to reproduce the issue and post that here.
The code should compile with minimal extra effort on someone else's
part. A complete copy of the Designer-generated code along with your
own custom code in a single file that can be pasted into an empty
project is best. Obviously this means that if you are binding the grid
to some data source or something, you need to hardcode some kind of data
source or initialization for the DataGridView as an alternative, since
we don't have a copy of your database.
And did I mention it should be the bare minimum required to reproduce
the issue?
Pete