Solved

Find/replace column names in gridview at runtime

Posted on 2009-07-06
2
295 Views
Last Modified: 2012-08-13
Hi,

Can somebody show me how to do a find/replace on the columns of a gridview at runtime? I want to check for certain column names, and rename them.

Thanks
0
Comment
Question by:zattz
2 Comments
 
LVL 13

Accepted Solution

by:
drypz earned 500 total points
ID: 24791361
Hi! Like this...

            foreach (DataGridViewColumn col in dataGridView1.Columns)
            {
                if (col.Name == "theName")
                    col.Name = "newName";
            }
0
 

Author Comment

by:zattz
ID: 24791423
thx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

932 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

12 Experts available now in Live!

Get 1:1 Help Now