473,796 Members | 2,560 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3681
Bill,

Try handling the ColumnHeaderMou seClick of the DataGridView.

Hope this helps,
Steve

"Bill Nguyen" <bi************ *****@jaco.comw rote in message
news:OK******** ********@TK2MSF TNGP03.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

"PlatinumBa y" <st*******@comm unity.nospamwro te in message
news:uF******** ******@TK2MSFTN GP02.phx.gbl...
Bill,

Try handling the ColumnHeaderMou seClick of the DataGridView.

Hope this helps,
Steve

"Bill Nguyen" <bi************ *****@jaco.comw rote in message
news:OK******** ********@TK2MSF TNGP03.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_C olumnHeaderMous eClick(ByVal sender As Object,
ByVal e As System.Windows. Forms.DataGridV iewCellMouseEve ntArgs) Handles
DataGridView1.C olumnHeaderMous eClick
If TypeOf Me.DataGridView 1.Columns(e.Col umnIndex) Is
DataGridViewChe ckBoxColumn Then
For Each row As DataRow In Me.DataGridView 1.Rows
CType(row.Item( e.ColumnIndex),
DataGridViewChe ckBoxCell).Valu e = True
Next
End If
End Sub

Hope this helps,
Steve

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

Thanks again

Bill

"PlatinumBa y" <st*******@comm unity.nospamwro te in message
news:uF******** ******@TK2MSFTN GP02.phx.gbl...
>Bill,

Try handling the ColumnHeaderMou seClick of the DataGridView.

Hope this helps,
Steve

"Bill Nguyen" <bi************ *****@jaco.comw rote in message
news:OK******* *********@TK2MS FTNGP03.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
13360
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 that sort and one row for filtering and the lower one with no header for the data. Only it is very complicated to work this way cause for example when the user click on sort on the upper datagridview I need to sort the lower grid and so on when...
2
9687
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. The dataset is created at run time, so I don't know column headers in advance. The table's column captions are set at run time, using the DataColumn.Caption property. The table is bound to the grid using the grid's DataSource property. Here is my...
1
4712
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 have changed to 40tude and can't see it in the newly dowloaded messages. It was originally html (tut tut) so maybe it didn't register. I have tried a new xml file and generated a new xsd file from it using xsd.exe and now the xml file produces...
2
7453
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 number you are scrolling past (Excel, Access). Sql server has the rownumbers on the Row Header column of its table view. Ideally, I would like to add row numbers to the Row Header column of the datagridview like sql server - Any suggestions...
3
7800
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 row header. This can be an image. Please any one share a code for this implementation. If i were to save this records, how can I trap those 3 modified rows without going throgh the whole row set?
2
4426
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 the unsorted view? I think I could "roll my own" by resetting the bindingsource.sort = nothing, but it seems like the datagridview should have something like this?
3
215
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 the column highlight in yellow. Where the row and column intersect, I'd like the cell to take on a red color. It's synonymous to a grid matrix for many maps... EXA: How many miles from one city to another:
2
10622
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 the datagridview column headers? I would like to change the forecolor value for individual column headers as required, so the Headertext displays in the required colour
1
1325
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 (http://www.codeproject.com/KB/vista/Firebird_2_and_Images.aspx) and trying to modify some column header text I saw that the datagridview contains column header text which I can't find in a string search, in the whole project ( nor in the database table columns...
0
9684
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9530
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10459
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10182
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10017
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6793
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.