Solved

Get DataGridView Column Name

Posted on 2008-06-11
2
4,509 Views
Last Modified: 2013-11-07
Hi,
How do i get the 'name' of a DataGridView Column?

Ive tried:
Dim myColumn as DataGridViewColumn
myColumn = DataGridView.Column.Item("Column Name")

No such luck!
0
Comment
Question by:hqpsystems
2 Comments
 
LVL 25

Expert Comment

by:apeter
ID: 21761032
Try below.

dataGridView.Columns[0].Name ' change the columns index to get appropriate name
0
 
LVL 14

Accepted Solution

by:
rachitkohli earned 50 total points
ID: 21768206
dataGridView1.Columns(0).Name will give you the column name

but based on a cell, if you want a column name, use :
DataGridView1.Columns(DataGridView1.Item(2, 1).ColumnIndex).Name
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

705 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

17 Experts available now in Live!

Get 1:1 Help Now