473,386 Members | 1,699 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,386 software developers and data experts.

Cell Events in Windows Datagrid

I have a datagrid that sits on a panel control. It has a Dataview bound to
it as its datasource that allows me to have the data sorted when it first
displays. I also AllowSorting on the grid.

I need to be able to determine when a specfic cell has been clicked and see
the value of that cell. This is all done with code vs using the IDE. If it
matters I have created a DataGridTableStyle to be able to set the column
width etc., and that seems to be working just fine.

The only events I've been able to get to fire so far are the Click and
DoubleClick for the row. I see the CurrentCell property, and the
CurrentCellChanged event in the doc, but have not been able to see the
property or get the event to fire. I know something is happening because at
run time when I click on a cell the contents are highlighted. I just need to
be able to get some additional code in that event.

In addition, I have progammtically added a line to set the
AlternatingBackColor property, but the grid seems to ignore that. Other
properties I set (i.e. Datasource) do seem to work.

Thanks for any help.

WhiteWizard (aka Gandalf)
--
MCSD.NET, MCAD, MCT
Feb 9 '06 #1
1 1260
Are you trying to get a single cell value from a user click? If so,
have you tried HitTest?

Point pt = new Point(e.X, e.Y);
System.Windows.Forms.DataGrid.HitTestInfo hit = this.HitTest(pt);

Brett

Feb 15 '06 #2

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

Similar topics

3
by: Dav | last post by:
I have a Winform with a derived datagrid and a button that adds a row to the datagrid in its Click event. The button has a shortcut text "&New Row". When I enter a value in a datagrid cell and...
0
by: Gidi | last post by:
hello, i was looking for this answer for something like a month and yesterday i found it. my problem was to register my dataGrid cells to event or to respond to events and what i did was to...
3
by: Maulin Vasavada | last post by:
Hi, I have DataTable and I want to actually put a LinkLabel in one the columns where I can click an do something BUT it seems I can't put LinkLabel in the table cell of DataTable. So as an...
4
by: simon | last post by:
which data control allows me to use a cell doubleClick event? I have time cells (something like Outlook calendar) and when user double click on one cell I would like to redirect to other window...
2
by: DraguVaso | last post by:
Hi, I'm looking for a nice way to format the cell of my datagrid according to some predefined 'rules'. I found a lot on the site of George shepherd, but it wasn't really what I was looking for:...
0
by: ariesc | last post by:
I upgraded from .NET 2002 to .NET 2003 and found one weird things on the LEAVE / ENTER events within a datagrid. I added handler to each textbox of a datagrid, then handle the ENTER/LEAVE events....
9
by: robert_rowe | last post by:
Does anyone know how to detect keypresses in a Datagrid cell? The Keypress event ofthe datagrid doesn't fire if you are in a cell. Neither does KeyUp & KeyDown. I've tried hooking in to the...
2
by: Ryan Liu | last post by:
Can someone give a sample to prevent a row from being deleted in a datatable? I tried e.Row.RejectChanges(); in dt_RowDeleting() but seems does not work. I need verify if there other data...
12
by: cj | last post by:
When viewing a datatable in a datagridview one of the columns in it is a "note" field which can be quite long. I would like to have the note field of the currently selected row of the datagrid...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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...

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.