469,945 Members | 2,014 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,945 developers. It's quick & easy.

DoubleClick in DataGrid

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 column or row header. How is it possible to get a
DoubleClick event to occur on a row wherever it is DoubleClick. I also want,
when a cell within the row is selected, that the entire row is marked as
selected not just the actual cell.

TIRislaa

Nov 20 '05 #1
4 1636
Tor,

Cells require that you add a handler for each control in the grid and trap
that.

You can make one doubleclick method and
do for each on the controls in the grid and

AddHandler (adding your double click method (handler) ) to handle the
doubleclick event for each of these controls.

hope this isn't too confusing.
I had the same problem and this solves it.

Shane
"Tor Inge Rislaa" <to*************@rislaa.no> wrote in message
news:Eb*****************@news2.e.nsc.no...
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 column or row header. How is it possible to get a
DoubleClick event to occur on a row wherever it is DoubleClick. I also want, when a cell within the row is selected, that the entire row is marked as
selected not just the actual cell.

TIRislaa

Nov 20 '05 #2
Do you have an example code for a DataGrid

TIRislaa

"SStory" <Th*******@TAKEOUTTHISSPAMBUSTERsofthome.net> skrev i melding
news:Oi*************@tk2msftngp13.phx.gbl...
Tor,

Cells require that you add a handler for each control in the grid and trap
that.

You can make one doubleclick method and
do for each on the controls in the grid and

AddHandler (adding your double click method (handler) ) to handle the
doubleclick event for each of these controls.

hope this isn't too confusing.
I had the same problem and this solves it.

Shane
"Tor Inge Rislaa" <to*************@rislaa.no> wrote in message
news:Eb*****************@news2.e.nsc.no...
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 column or row header. How is it possible to get a
DoubleClick event to occur on a row wherever it is DoubleClick. I also

want,
when a cell within the row is selected, that the entire row is marked as
selected not just the actual cell.

TIRislaa


Nov 20 '05 #3
I use this to trap some function keys.

Private Sub SetGridControlKeydownHandlers()
Dim c As Control
For Each c In grdMyGridName.Controls
AddHandler c.KeyDown, AddressOf HandleFunctionKeys
Next
End Sub

Private Sub HandleFunctionKeys(ByVal Sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs)
'handle form hotkeys F6,F7,F8,F9
If e.KeyCode = Keys.F6 Then
e.Handled = True
'do something
ElseIf e.KeyCode = Keys.F7 Then
e.Handled = True
'do something
ElseIf e.KeyCode = Keys.F8 Then
e.Handled = True
'do something
ElseIf e.KeyCode = Keys.F9 Then
e.Handled = True
'do something
End If
End Sub

call SetGridControlKeydownHandlers()
everytime you refresh the grid data.

Hope this helps you.

Shane

"Tor Inge Rislaa" <to************@rislaa.no> wrote in message
news:m8*****************@news4.e.nsc.no...
Do you have an example code for a DataGrid

TIRislaa

"SStory" <Th*******@TAKEOUTTHISSPAMBUSTERsofthome.net> skrev i melding
news:Oi*************@tk2msftngp13.phx.gbl...
Tor,

Cells require that you add a handler for each control in the grid and trap
that.

You can make one doubleclick method and
do for each on the controls in the grid and

AddHandler (adding your double click method (handler) ) to handle the
doubleclick event for each of these controls.

hope this isn't too confusing.
I had the same problem and this solves it.

Shane
"Tor Inge Rislaa" <to*************@rislaa.no> wrote in message
news:Eb*****************@news2.e.nsc.no...
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 column or row header. How is it possible to get a
DoubleClick event to occur on a row wherever it is DoubleClick. I also

want,
when a cell within the row is selected, that the entire row is marked as selected not just the actual cell.

TIRislaa



Nov 20 '05 #4

The following code worked for me. It highlights the cell (but not the
row) and made the doubleclick handler of my datagrid run without adding
a handler to each control.

Dim c As Control
For Each c In dgridMain.Controls
c.Enabled = False
Next

Hope this helps someone!

Tor Inge Rislaa wrote:
*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 column or row header. How is it possible to get a
DoubleClick event to occur on a row wherever it is DoubleClick. I
also want,
when a cell within the row is selected, that the entire row is marked
as
selected not just the actual cell.

TIRislaa *


--
Banmere
------------------------------------------------------------------------
Posted via http://www.mcse.ms
------------------------------------------------------------------------
View this thread: http://www.mcse.ms/message281664.html

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by JoeHenrich | last post: by
5 posts views Thread by David Lozzi | last post: by
1 post views Thread by Duke | last post: by
3 posts views Thread by C Glenn | last post: by
2 posts views Thread by Looch | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.