Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DATAGRID COLOMNORDER

Status
Not open for further replies.

lode

Programmer
Nov 8, 2001
208
BE
Hi,

How can i change the columnorder in a datagrid ?

 
you'll have to create TableStyle for the DataGrid.

something like this

Code:
DataGrid1.DataSource = myDataSet.Tables("tableName")

Dim myTS As New DataGridTableStyle

'Set MappingName for TableStyle
myTS.MappingName = "tableName"

'Create the column in the order you want them to appear.

'Create 1st column.
Dim myCOL As New DataGridTextBoxColumn
With myCOL
    .MappingName = "App_ID"
    .HeaderText = "App_ID"
    .Width = 0
End With
myTS.GridColumnStyles.Add(myCOL)

'Create 2nd column.
myCOL = New DataGridTextBoxColumn
With myCOL
    .MappingName = "FirstName"
    .HeaderText = "First Name"
End With
myTS.GridColumnStyles.Add(myCOL)

'and so on...

'Add TableStyle to the DataGrid.
DataGrid1.TableStyles.Add(myTS)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top