Capture click/double-click events from datatable 
Author Message
 Capture click/double-click events from datatable
Hi,

How can I capture the click/double-click events from a datatable. There are
a few listed events in the datable, but nothing mentioned about mouse
events.

Thanks in advance,

Randy



Mon, 02 May 2005 00:17:32 GMT  
 Capture click/double-click events from datatable
Randy,

    If you want, you can subclass the DataGrid class and then override the
WndProc method, looking for the double click mouse message.  Once you get
that, you can process it any way you want.  Just make sure that you call the
base class implementation for messages that you aren't looking to process
specifically.

    Hope this helps.

--
               - Nicholas Paldino [.NET/C# MVP]


Quote:
> Hi,

> How can I capture the click/double-click events from a datatable. There
are
> a few listed events in the datable, but nothing mentioned about mouse
> events.

> Thanks in advance,

> Randy



Mon, 02 May 2005 00:22:30 GMT  
 Capture click/double-click events from datatable
If you are talking about datagrid (not datatable ) her ethe code to capture
click event
  Private Sub dg_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles dg.MouseDown
        ' X & Y are in the grid' coordinates. If they are in screen
coordinates, call dataGrid1.PointToClient method
        Dim pt = New Point(e.X, e.Y)
        Dim hti As DataGrid.HitTestInfo = dg.HitTest(pt)

        If hti.Type = DataGrid.HitTestType.Cell Then
            'cell text)
            MessageBox.Show(dg(hti.Row, hti.Column).ToString())
            'row number
            MsgBox((dg.CurrentCell.RowNumber).ToString)
            'col number
            MsgBox((dg.CurrentCell.ColumnNumber).ToString)
        Else
            'header name ( column)
            If hti.Type = DataGrid.HitTestType.ColumnHeader Then
                MsgBox(ds.Tables(0).Columns(hti.Column).ToString)'ds defined
earlier
            End If
        End If

 End Sub


Quote:
> Randy,

>     If you want, you can subclass the DataGrid class and then override the
> WndProc method, looking for the double click mouse message.  Once you get
> that, you can process it any way you want.  Just make sure that you call
the
> base class implementation for messages that you aren't looking to process
> specifically.

>     Hope this helps.

> --
>                - Nicholas Paldino [.NET/C# MVP]



> > Hi,

> > How can I capture the click/double-click events from a datatable. There
> are
> > a few listed events in the datable, but nothing mentioned about mouse
> > events.

> > Thanks in advance,

> > Randy



Mon, 02 May 2005 04:21:52 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. System tray icon, single click event fires before double click

2. Click and Double-click events

3. Form Click .vs. Double-Click Events

4. Double-click vs single-click on macro button

5. Double-Click vs. click

6. Click vs Double click

7. Double-Click without Click

8. capturing the double click - phrogg

9. Simulate click and double-click respectively from WinForce

10. Click and Double Click, and A List of Questions

11. How to differentiate between Click and Double-Click?

12. Double clicks and single clicks

 

 
Powered by phpBB® Forum Software