Solved

Gridview Column title

Posted on 2009-05-04
3
271 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 50 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now