Solved

Gridview Column title

Posted on 2009-05-04
3
307 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

623 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