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
Solved

Find/replace column names in gridview at runtime

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Device Location 4 36
Example works but why do I need to click twice on button 4 48
bound data table problem 2 33
LINQ Select all records by MAX data syntax help 1 18
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

829 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