Displaying field name in datagridview

S

SF

Hi,

In my first attemp to work with VB.NET, I have attached tables to
datagridview. Data has been display succesfully but my problem is that the
field names is displaying as header of the table of the datagrid. Is there a
way to change the displayed header to the one that is readable such as
change from Ck_Project_ID to Project ID etc...
If so how would I do that

SF
 
G

Gilbert Tordeur

Yes. In the designer window select your grid, then click on the small
triangle on the right top corner and set the properties you like.

Gilbert
 
M

Mr. Taco

You can assign headers in your code like this:


DataGridView1.DataSource = datatable123
DataGridView1.Columns(0).HeaderText = "Account #"
DataGridView1.Columns(1).HeaderText = "Customer Name"
DataGridView1.Columns(1).HeaderText = "Whatever"

This way you can make them dynamic should you need to reuse the
datagridview for more than one datasource.

-T
 
S

SF

Thank for your advice.

SF

Mr. Taco said:
You can assign headers in your code like this:


DataGridView1.DataSource = datatable123
DataGridView1.Columns(0).HeaderText = "Account #"
DataGridView1.Columns(1).HeaderText = "Customer Name"
DataGridView1.Columns(1).HeaderText = "Whatever"

This way you can make them dynamic should you need to reuse the
datagridview for more than one datasource.

-T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top