Solved

Gridview Column title

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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