473,399 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Get header name from data grid

Hi, all

Could any one suggest me how to get the column name or
column index of the datagrid , when user click on any column header of
the grid in vb.net (windows) application ..

Jan 25 '07 #1
2 11094
jvb
Try trapping the mousedown event and use the HitTestInfo class to find
what part of the datagrid the user clicked.

On Jan 25, 11:21 am, "neeraj" <neeraj....@gmail.comwrote:
Hi, all

Could any one suggest me how to get the column name or
column index of the datagrid , when user click on any column header of
the grid in vb.net (windows) application ..
Jan 25 '07 #2
'get index and value
Private Sub dgv_CellClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv.CellClick
Dim iRow As Integer = dgv.CurrentRow.Index
Dim iCol As Integer = dgv.CurrentCell.ColumnIndex
dgv.CurrentCell = dgv(iCol, iRow)
MsgBox(dgv.CurrentCell.Value)

End Sub

'get header text
Private Sub Button9_Click(ByVal sender As Object, _
ByVal args As EventArgs) Handles Button9.Click

For Each column As DataGridViewColumn _
In dataGridView.Columns

Next
End Sub
"neeraj" <ne********@gmail.comwrote in message
news:11**********************@m58g2000cwm.googlegr oups.com...
Hi, all

Could any one suggest me how to get the column name or
column index of the datagrid , when user click on any column header of
the grid in vb.net (windows) application ..

Jan 26 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Will | last post by:
In a Windows form: I need the code to manually set the header name of a column in a datagrid to anything i want. Everytime i retieve records from a database, the coloum header of the datagrid...
0
by: James lennon | last post by:
I am attempting to format a Window.Forms.DataGrid. How do I set the color for the grid lines in the data grid header. The GridLineColor attribute in the table style does not set the color of the...
5
by: objectref | last post by:
Hi to all, i populate a ListView with data from a datareader and i just want to know the column name of the cell that the user clicks on. E.x., if the user clicks on the 2nd column, 3rd row in...
1
by: Joe Dunleavy | last post by:
Hi Guys, Hopefully some one will have come across this issue already. I have a DataGrid inside a Div where a scroll bar displays once a certain height is meet --> <div id="dvSales"...
6
by: NerdRunner | last post by:
Hello group, I am using a data grid with template columns. I have a drop list in the header of the template column that will allow users to select a value for filtering of the data in the grid....
0
by: ER | last post by:
Hi Guys Started having a play with WPF and need some direction with a grid. I am trying to build a list of products in a grid view with combox boxes as column headers that allow filtering and...
1
sujathaeeshan
by: sujathaeeshan | last post by:
Hi All, I am doing UI design(form design modifications) not programmatically. I am facing problem while appplying font to Data grid column . Here i am placing Data Grid within GroupBox. When...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.