Id like to know, if say i have a data grid that is connected to a sql database, it displays the table columns once a user enters a search. eg;(in your sql table colnm names are member_name,m_address). Now instead of display those names from the sql, can it display your own customized coulmn headings on the datagrid. eg(m_address shall become Address)?

Thanks guys

Recommended Answers

yes just after the code where you assigning the datasource to your grid use this code.

datagridview1.column(0).headertext = "your text"
datagridview1.column(1).headertext = "your text"
.
.
.

Regards

Jump to Post

All 3 Replies

yes just after the code where you assigning the datasource to your grid use this code.

datagridview1.column(0).headertext = "your text"
datagridview1.column(1).headertext = "your text"
.
.
.

Regards

hi but this is not a datagrid view bt the datagrid is there a difference between them? i used the datagrid to display the information. thanks

Hmm, I haven't tried using datagrid or gridview but you can try using alias
example:

Select m_address as address
From table

The 'address' there is the alias
Executing this query will change the header name from m_address to 'address'

Hope this helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.