473,320 Members | 1,922 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,320 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 8242
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.