1
Answer

Data Grid Column Order Problem

George Laing

George Laing

15y
7.9k
1

Hi
  I am having a problem with the order of the columns in my data grid. I have set the order I want in the data grid property Edit Columns. When I run the project 2 columns are way out of position. I tried to move the out of position column using column order but it is ignored. I then tried coding the position using event private void GridDisplayOrder(). I get the message object reference not set to an instance of an object. Not sure how to get around this error. Here is the event I use

 private void GridDisplayOrder()
        {
            Grid_Property.Columns["pContract_NO"].DisplayIndex = 0;
            Grid_Property.Columns["pProperty_ID"].DisplayIndex = 1;
            Grid_Property.Columns["pVersion"].DisplayIndex = 2;
            etc
            etc

any assistance would be appreciated

Answers (1)