Home › Forums › WinForms controls › Xceed Grid for WinForms › Doubleclick event in Xceed grid.
-
AuthorPosts
-
#14305 |
Hi
Anybody can me for handling the double click event of xceed grid? The code I am adding to the message. Ya, when I am running the application I am able to get the result of double click event. But double click event is not Firing for the 1st row of the grid. Plese help me to solve this problem.Thanks in advance.Baijayanti
Dim bFlag As Boolean = False
Dim ds As New DataSet
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim con As New SqlConnection(“data source=XYZ;initial catalog=Insurance;password=sa;persist security info=True;user id=sa;packet size=4096”)
Dim com As New SqlCommand
Dim adapt As New SqlDataAdapter
con.Open()
Debug.WriteLine(“connection to the database is sucessful”)
com.Connection = con
com.CommandText = “SELECT * FROM tsmAddOnRisk”
adapt.SelectCommand = com
adapt.Fill(ds)
GridControl1.DataSource = ds
GridControl1.DataMember = ds.Tables(0).ToString
Dim row1 As Xceed.Grid.DataRow
row1 = GridControl1.CurrentRow
MsgBox(row1.Cells(“Add_On_Risk”).Value.ToString)
End Sub
Private Sub Cell_DoubleClick(ByVal sender As Object, ByVal e As EventArgs)
Dim cell As Xceed.Grid.Cell = sender
‘Dim row As Xceed.Grid.DataRow = cell.ParentRowIf Not bFlag Then
MessageBox.Show(“test”)
bFlag = True
Exit Sub
End IfEnd Sub
Private Sub GridControl1_AddingDataRow(ByVal sender As Object, ByVal e As Xceed.Grid.AddingDataRowEventArgs) Handles GridControl1.AddingDataRow
Dim cell As Xceed.Grid.Cell
For Each cell In GridControl1.DataRowTemplate.Cells
AddHandler cell.DoubleClick, AddressOf Me.Cell_DoubleClick
AddHandler cell.MouseEnter, AddressOf Me.cell_MouseEnter
Next
End Sub
Private Sub cell_MouseEnter(ByVal sender As Object, ByVal e As EventArgs)
bFlag = False
End SubImported from legacy forums. Posted by mala_jena (had 3288 views)
This is probably due to the fact that the row is still being “edited”. That said, I strongly suggest that you subscribe to the DataRowTemplate instead of doing this during the AddingDataRow event :
Dim cell As DataCell
For Each cell in GridControl1.DataRowTemplate.Cells
AddHandler cell.DoubleClick, AddressOf Me.cell_DoubleClick
Next cellImported from legacy forums. Posted by Matt (had 1034 views)
I had the same problem when i fire the double click event ! The double click work on 2nd, 3rd..rows but i did not fire on the first row. What was the reason and how can i fix it ?
Imported from legacy forums. Posted by takume (had 480 views)
The way to do this is through the DataRowTemplate, as explained by Matt, before the Grid is filled with the data. Is it what you are doing?
Imported from legacy forums. Posted by André (had 4303 views)
-
AuthorPosts
- You must be logged in to reply to this topic.