Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Gridview Column title

Posted on 2009-05-04
3
Medium Priority
?
317 Views
Last Modified: 2012-05-06
i am using a gridview control and need to change the title of a column to the current year of 2009. any ideas?
Thanks
Jim
0
Comment
Question by:jmrasmus
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
Cebik earned 200 total points
ID: 24295484

DataGridView dgv = new DataGridView();
dgv.Columns.Add("col1", "col1");
dgv.Columns.Add("col2", "col2");
dgv.Columns.Add("col3", DateTime.Now.Year.ToString());
 
dgv.Columns[0].HeaderText = DateTime.Now.Year.ToString();
dgv.Columns["col2"].HeaderText = DateTime.Now.Year.ToString();

Open in new window

0
 

Author Closing Comment

by:jmrasmus
ID: 31577556
Thanks!
0
 
LVL 6

Expert Comment

by:Cebik
ID: 24295539
you're welcome ;)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question