Link to home
Create AccountLog in
Avatar of thesmashest
thesmashest

asked on

Column Header and Column Name

I have a DataGrid with a DataTable as its source. The DataTable has multiple columns.

Is it possible to have a column header that is different than the column's name. (i.e. The column header on the DataGrid would display "Full Customer Name" but I the actual column name would be Full_Name.
Avatar of VBRocks
VBRocks
Flag of United States of America image

Not sure about the DataGrid.  I always use a DataGridView...  Why don't you try that?  It has a Columns Property, which you can add columns to and set the HeaderText, which is just what you'r looking for.
Avatar of thesmashest
thesmashest

ASKER

Correction....I am using a DataGridView. I defined the columns only in the DataTable like so: DataTable.Columns.Add("Example") and then I bind the DataTable to the DataGridView.

How do I create a column in a DataGridView.....and what happens when I bind the DataTable to the DataGridView....do the columns' settings of the DataTable override the columns' settings of the DataGridView?
Ok, I have created all columns in the DataGridView. All the DataRows are located in the DataTable....how do I bind only DataRows of the DataTable to the DataGridView. I tried to do this: DataGridView.Rows = DataTable.Rows but it's not working
try: DatagridView.Datasource=DataTable
ASKER CERTIFIED SOLUTION
Avatar of VBRocks
VBRocks
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer