By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,239 Members | 1,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,239 IT Pros & Developers. It's quick & easy.

DoubleClick in DataGrid

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a

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.