anthony

anthony

  • NA
  • 71
  • 0

ordering issue with DataGridView

Oct 1 2007 9:15 AM

Im am trying to get the ordering right with a DataGridView with the order for example Id, Name, Description , Include. But when i run the included sample I get the order Id, Name, Include, description and im not sure why...

 

 

InitializeComponent();

DataGridViewTextBoxColumn ColumnId = new DataGridViewTextBoxColumn();

DataGridViewTextBoxColumn ColumnName = new DataGridViewTextBoxColumn();

DataGridViewTextBoxColumn ColumnDesc = new DataGridViewTextBoxColumn();

DataGridViewCheckBoxColumn ColumnInc = new DataGridViewCheckBoxColumn();

this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[]

{

ColumnId, ColumnName, ColumnDesc, ColumnInc

});

ColumnId.HeaderText = "ID";

ColumnId.DataPropertyName = "RuleId";

ColumnId.DisplayIndex = 0;

 

ColumnName.HeaderText = "Name";

ColumnName.DataPropertyName = "RuleName";

ColumnName.DisplayIndex = 1;

 

ColumnDesc.HeaderText = "Description";

ColumnDesc.DataPropertyName = "RuleDesc";

ColumnDesc.DisplayIndex = 2;

 

ColumnInc.HeaderText = "Inc";

ColumnInc.DisplayIndex = 3;