471,321 Members | 2,097 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,321 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)
Feb 9 '06 #1
1 1211
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);


Feb 15 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by simon | last post: by
9 posts views Thread by robert_rowe | last post: by
reply views Thread by rosydwin | last post: by

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.