472,950 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

DoubleClick on DataGrid

I would like one DoubleClick event handler to handle all double clicks
throughout a DataGrid. I've assigned a DoubleClick event handler to the
DataGrid and it works nifty-spiffy so long as I click outside the data.
The trouble is, the underlying cells or columns or whatever would like
to have something to say about this. The cells respond to the
DoubleClick but not the grid.

How do I get my event handler to handle all double clicks within the grid?
Dec 13 '05 #1
3 8218
Hi Glenn,

I've tried this out and it seems that by implementing DoubleClick the event
will be fired whenever you double click anywhere on the DataGrid, cells and
all. One thing to note though is that if you have CellDoubleClick as well as
DoubleClick implemented first DoubleClick will fire and then immediately
CellDoubleClick will fire when you double click on a cell. Could this be
causing some problems for you? Let me know if it helped. Good Luck!

"C Glenn" wrote:
I would like one DoubleClick event handler to handle all double clicks
throughout a DataGrid. I've assigned a DoubleClick event handler to the
DataGrid and it works nifty-spiffy so long as I click outside the data.
The trouble is, the underlying cells or columns or whatever would like
to have something to say about this. The cells respond to the
DoubleClick but not the grid.

How do I get my event handler to handle all double clicks within the grid?

Dec 14 '05 #2
This appears to be the problem, but what and where is CellDoubleClick?
I can't find it in the list of events for the DataGrid. It does appear
though that when I DoubleClick on a Cell the native DoubleClick behavior
for the cell is invoked instead of the DoubleClick code that I've written.

Any suggestions for getting around this will be greatly appreciated.

Justin Swan (MSFT) wrote:
Hi Glenn,

I've tried this out and it seems that by implementing DoubleClick the event
will be fired whenever you double click anywhere on the DataGrid, cells and
all. One thing to note though is that if you have CellDoubleClick as well as
DoubleClick implemented first DoubleClick will fire and then immediately
CellDoubleClick will fire when you double click on a cell. Could this be
causing some problems for you? Let me know if it helped. Good Luck!

"C Glenn" wrote:

I would like one DoubleClick event handler to handle all double clicks
throughout a DataGrid. I've assigned a DoubleClick event handler to the
DataGrid and it works nifty-spiffy so long as I click outside the data.
The trouble is, the underlying cells or columns or whatever would like
to have something to say about this. The cells respond to the
DoubleClick but not the grid.

How do I get my event handler to handle all double clicks within the grid?

Dec 14 '05 #3
the CellDoubleClick event appears in the events tab for me when the DataGrid
object is selected, which version of VS are you using? As a workaround you
could try using code something like this in the form.cs file which should
force the call to double click if CellDoubleClick is the only event being
called at the moment. Obviously if both events are actually firing you will
get DoubleClick called twice with this.

private void dataGridView1_CellDoubleClick(object sender,
DataGridViewCellEventArgs e)
{
dataGridView1_DoubleClick(sender, new EventArgs());
}

You will also need to include the following in the form.designer.cs file:

this.dataGridView1.CellDoubleClick += new
System.Windows.Forms.DataGridViewCellEventHandler( this.dataGridView1_CellDoubleClick);

If this doesn't help then some details on your DoubleClick implementation
might be useful in discovering why it's not working in this situation. Good
Luck!

"C Glenn" wrote:
This appears to be the problem, but what and where is CellDoubleClick?
I can't find it in the list of events for the DataGrid. It does appear
though that when I DoubleClick on a Cell the native DoubleClick behavior
for the cell is invoked instead of the DoubleClick code that I've written.

Any suggestions for getting around this will be greatly appreciated.

Justin Swan (MSFT) wrote:
Hi Glenn,

I've tried this out and it seems that by implementing DoubleClick the event
will be fired whenever you double click anywhere on the DataGrid, cells and
all. One thing to note though is that if you have CellDoubleClick as well as
DoubleClick implemented first DoubleClick will fire and then immediately
CellDoubleClick will fire when you double click on a cell. Could this be
causing some problems for you? Let me know if it helped. Good Luck!

"C Glenn" wrote:

I would like one DoubleClick event handler to handle all double clicks
throughout a DataGrid. I've assigned a DoubleClick event handler to the
DataGrid and it works nifty-spiffy so long as I click outside the data.
The trouble is, the underlying cells or columns or whatever would like
to have something to say about this. The cells respond to the
DoubleClick but not the grid.

How do I get my event handler to handle all double clicks within the grid?

Dec 14 '05 #4

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

Similar topics

2
by: JoeHenrich | last post by:
I am using VS.NET 2003 and am having an interesting issue with a Listbox control. Essentially, I have a form with a listbox on it. In the listbox doubleclick event I would like to do some...
0
by: Koo Min | last post by:
Hello, I've added drag-and-drop feature to a windows forms label control which is contained in a panel. And I added a doubleclick event handler to the drag-and-drop-abled label, but doubleclick...
5
by: David Lozzi | last post by:
Hey All, I have a listbox that I would like to fire an event on doubleclick. the onDoubleClick property of the listbox isnt available be default, and I know it will work with Javascript, but how...
2
by: Jan Nielsen | last post by:
Hi I have a form with some comboboxes My problem is that they don't react on my doubleclick event. I doubleclick in the textbox part of the combo. And nothing happens. They react on...
1
by: Duke | last post by:
Trying to learn vb.net & am frustrated. I've got data in a grid. Want user to be able to double- click on a row and see a new form with additional detail for that row. Works fine, so long as...
2
by: Rolf Falnes | last post by:
Hi. Does anyone know how to trigger the doubleclick mouse event in a datagrid cell (DatagridTextbox )? Regards, Rolf Falnes Datapartner AS
3
by: active | last post by:
DoubleClick seems to work OK with a ListBox. However, with a ListView I never get the event fired. I looked at both the LIstBox and ListView events and neither lists the DoubleClick??? But...
4
by: Tor Inge Rislaa | last post by:
DoubleClick in DataGrid Hi I have a Datagrid bound to a dataset that I want to write a DoubleClick procedure on. My problem is that the DoubleClick event is raised only when DoubleClicking the...
2
by: Looch | last post by:
Hi All, Am just getting into handlers at the moment and had a question. How would I write the code (the 'public void example handles cell doubleclick...) for a method to handle a double click in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.