Solved

Find/replace column names in gridview at runtime

Posted on 2009-07-06
2
294 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

706 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

18 Experts available now in Live!

Get 1:1 Help Now