By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,616 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

How to set header name of datagridview vb.net

P: 1
I used the vb.net 2008
I want to set the header name of my datagridview when connect to my database.

here is the problem..
field name of database is "item_code" also show the same in data gridgridview..

I want to change it to be "Item Code" in datagridview, but i don't kow how to code it. When i change it manually the data from database not appear..pls help me solve this..
Jul 30 '12 #1
Share this Question
Share on Google+
4 Replies


PsychoCoder
Expert Mod 100+
P: 465
Just go into your database and change that value like so "Item Code";
Jul 30 '12 #2

P: 85
you can add an item template or Bound Field in the grid view to bind the data, and set the header text of item template or bound field to Item Code
...
Addan
Aug 7 '12 #3

Frinavale
Expert Mod 5K+
P: 9,731
Mudassir, a DataGridView is not the same as a ASP.NET GridView and does not use item templates.

Anyways, the DataGridView has DataGridViewColumns and a DataGridViewColumn has a HeaderText Property that you can use to set the column's headers.

So, loop through the columns in your DataGridView, find the one with the header text that you don't like, and change it :)

-Frinny
Aug 7 '12 #4

P: 85
Pardon me , i thought it a grid view of asp.net..
Aug 7 '12 #5

Post your reply

Sign in to post your reply or Sign up for a free account.