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

|
0 Comments:
Post a Comment
<< Home