473,397 Members | 2,099 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,397 software developers and data experts.

Dumb datagridview column header question!

I can't figure out how to identify/display the column header name in
Mouseclick event.
This is a checkbox column type and I would like all cells in this column to
toggle checked/unchecked when the user clicks on the column header.
YOur help is greatly appreciated.

Bill
Jun 12 '07 #1
3 3644
Bill,

Try handling the ColumnHeaderMouseClick of the DataGridView.

Hope this helps,
Steve

"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:OK****************@TK2MSFTNGP03.phx.gbl...
>I can't figure out how to identify/display the column header name in
Mouseclick event.
This is a checkbox column type and I would like all cells in this column
to toggle checked/unchecked when the user clicks on the column header.
YOur help is greatly appreciated.

Bill


Jun 13 '07 #2
I can do this but how do I know which column contain the clumnheader being
clicked/selected?

Thanks again

Bill

"PlatinumBay" <st*******@community.nospamwrote in message
news:uF**************@TK2MSFTNGP02.phx.gbl...
Bill,

Try handling the ColumnHeaderMouseClick of the DataGridView.

Hope this helps,
Steve

"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:OK****************@TK2MSFTNGP03.phx.gbl...
>>I can't figure out how to identify/display the column header name in
Mouseclick event.
This is a checkbox column type and I would like all cells in this column
to toggle checked/unchecked when the user clicks on the column header.
YOur help is greatly appreciated.

Bill



Jun 13 '07 #3
Bill,

What about something like this?

Private Sub DataGridView1_ColumnHeaderMouseClick(ByVal sender As Object,
ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArg s) Handles
DataGridView1.ColumnHeaderMouseClick
If TypeOf Me.DataGridView1.Columns(e.ColumnIndex) Is
DataGridViewCheckBoxColumn Then
For Each row As DataRow In Me.DataGridView1.Rows
CType(row.Item(e.ColumnIndex),
DataGridViewCheckBoxCell).Value = True
Next
End If
End Sub

Hope this helps,
Steve

"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>I can do this but how do I know which column contain the clumnheader being
clicked/selected?

Thanks again

Bill

"PlatinumBay" <st*******@community.nospamwrote in message
news:uF**************@TK2MSFTNGP02.phx.gbl...
>Bill,

Try handling the ColumnHeaderMouseClick of the DataGridView.

Hope this helps,
Steve

"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:OK****************@TK2MSFTNGP03.phx.gbl...
>>>I can't figure out how to identify/display the column header name in
Mouseclick event.
This is a checkbox column type and I would like all cells in this column
to toggle checked/unchecked when the user clicks on the column header.
YOur help is greatly appreciated.

Bill




Jun 14 '07 #4

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

Similar topics

10
by: milk-jam | last post by:
I'm trying to set my datagridview so that the first row will be left blank and to use it as a filtering filed for the datagridview. Until now I was using 2 datagridview the upper one with a header...
2
by: David Veeneman | last post by:
How can I set a bound DataGridView control to use a dataset table's column captions, instead of column names? I'm working with a DataGridView control, which I have bound to a table in a dataset....
1
by: mark carew | last post by:
Hi, Problem - An extra column to the left (even with row headers disabled) ---------------------------------------------------------- Apologies if this posting is already in the newsgroup; but...
2
by: Rich | last post by:
Hello, Some database applicatins have a tooltip feature where when you are dragging the scrollbar of the table view a tooltip appears next to the mouse cursor displaying the approximate record...
3
by: Prashwee | last post by:
Hello All In my windows application I am using DataGridView as my grid control. I populated let's say 10 rows of data and modified 3 random rows. I need to put some sort of Edit Marker in the...
2
by: Rick | last post by:
VS 2005/Pro I'm using a DataGridView in a Windows form and allowing the user to sort the columns by clicking on the header column. Is there some method offered by the grid to return back to...
3
by: =?Utf-8?B?VHJlY2l1cw==?= | last post by:
Hello, Newsgroupians: I'm creating a control derived from DataGridView. I'd like the user to click a row and have the row highlight in yellow. I'd then like the user to click a column and have...
2
by: Steve | last post by:
Hi All I am using VB.net 2005 windows forms I use the Datagridview.cellformatting event to change the colours of individual cells as required and all works fine How can I do the same for...
1
by: Ronny | last post by:
Please excuse me if my question is not so clever.... I just learn the stuff of database and datagridview class and I have a question. After download a sample in CodeProject.com...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.