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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using column description as column header instead of column name

Status
Not open for further replies.

csutton

Programmer
Dec 27, 2000
213
US
I am currently using a DATAGRIDVIEW...

I have several "configuration" tables, basically tables that hold lists like customer type, activity type, etc. and each table could have additional attributes (like checkboxes) for each item in the table.

Instead of making a form for each table, I have 1 form, with a dropdown the user can click on to edit each of the table lists.

I have everything working well, except in the grid, the column headers display the column names. Is there anyway of telling the datagridview (or I also have componentOne grids) to use the column descriptions in the table instead o the column name?

I know I could set it in code, but once I have a lot of tables, I run the risk of coding errors, etc. I am NOT using stored procedures at this point.

Thanks,
Chris


~~ Chris ~~
 
After you set the datasource and set your bindings, you can change the column attributes...

YourGrid.Columns(0).HeaderText = "MyDescription"
YourGrid.Columns(0).Width = 100
 
woyker, thanks but that doesn't answer my question... I'm looking to use the COLUMN DESCRIPTION that is in the actual table definition...

thank you though.

~~ Chris ~~
 

I think your problem is the Column Description is not readily available in the DataSet. You will need to run a query to get the Descriptions from the Database, then use the Descriptions retreived in your datagridview.

Assuming you are using SqlServer you should look into "fn_listextendedproperty (Transact-SQL)" to get the extended properties for the table.

 
Sorry, misread the question. My fingers were more anxious than my eyes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top