Double-click event in datagrid?

G

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
 
C

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
///
 
G

Graham Blandford

Hi..
I think the ASP class is diferent from the windows form class of the
datagrid... there doesn't appear to be a ItemDataBound method for the
windows form version..
unless I'm missing something...

If you happend to come across a windows form solution I'd appreciate any
input.

Thanks,
Graham
 
C

Cor Ligthert

Hi Graham,

I sended a sample for a Window form, is there something wrong with that?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top