Home  |  Index  |  Dotnet4all Snippets  |  Submit resources
About  |  Mail us  
Dotnet4all Logo
Double-click event in datagrid? (Thursday, December 23, 2004)
 

Found the following interesting discussion in the Newsgroups:

Double-click event in datagrid?
by:Graham Blandford

Hi all,

Can anyone tell me how I can detect the double_click event in a datagrid
CELL. I have a read-only bound grid that appears to only receive the event
if you double_click the header or in between a row...

I'm basically trying to retrieve the value of the underlying row to retrieve
a record selection.

Any help would be appreciated.

Thanks,
Graham


 Reply:
by:Cor Ligthert

 Hi Graham,

You can try to use a textbox in the datagrid and than use the event from
that.

I made once a sample with a tooltip in the datagrid column so maybe you can
change that yourself and try if it works.

I hope this helps?

Cor

\\Private WithEvents dtbCol1 As DataGridTextBox
Private ToolTip1 As New ToolTip
')
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Datagrid1.ReadOnly = True
Dim ts As New DataGridTableStyle
ts.MappingName = ds.Tables(0).TableName
Dim column As New DataGridTextBoxColumn
ts.GridColumnStyles.Add(column)
DataGrid1.TableStyles.Add(ts)
column = DirectCast(ts.GridColumnStyles(0), DataGridTextBoxColumn)
dtbCol1 = DirectCast(column.TextBox, DataGridTextBox)
column.MappingName = ds.Tables(0).Columns(0).ColumnName
column.HeaderText = "Cor"
column.Width = 30
dv = New DataView(ds.Tables(0))
dv.AllowNew = False
DataGrid1.DataSource = dv
End Sub
Private Sub dtbCol1_ToolTip(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles dtbCol1.MouseEnter
ToolTip1.SetToolTip(DirectCast(sender, DataGridTextBox), _
"Row: " & DataGrid1.CurrentRowIndex + 1)
End Sub
///


 Reply:
by:Ken Tucker [MVP]

 Hi,

http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q869q

Ken



Posted by Xander Zelders



 
Previous Posts
    - Catching "Came from Row" on a RowChange in Datagri...
    - Delete Option on a Right Click Menu?
    - How to open a new browser
    - Opening an existing file on my PC
    - Convert charref ({) to normal letters
    - Convert charref ({) to normal letters
    - Using projects
    - Help with Datagrid events please.
    - Quotes within a text string
    - Quotes within a text string

Archives
    - 10/03/2004 - 10/10/2004
    - 10/10/2004 - 10/17/2004
    - 10/17/2004 - 10/24/2004
    - 10/24/2004 - 10/31/2004
    - 10/31/2004 - 11/07/2004
    - 11/21/2004 - 11/28/2004
    - 11/28/2004 - 12/05/2004
    - 12/05/2004 - 12/12/2004
    - 12/12/2004 - 12/19/2004
    - 12/19/2004 - 12/26/2004
    - 12/26/2004 - 01/02/2005
    - 01/23/2005 - 01/30/2005
    - 01/01/2006 - 01/08/2006
    - 09/24/2006 - 10/01/2006


Disclaimer & Terms of Use  | DotNet4All.Com concept & © 2004 - 2007 by  Zelders²  - Holland