Home Forums WinForms controls Xceed Grid for WinForms Doubleclick event in Xceed grid.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #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.ParentRow

    If Not bFlag Then
    MessageBox.Show(“test”)
    bFlag = True
    Exit Sub
    End If

    End 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 Sub

    Imported from legacy forums. Posted by mala_jena (had 3288 views)

    User (Old forums)
    Member
    Post count: 23064

    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 cell

    Imported from legacy forums. Posted by Matt (had 1034 views)

    User (Old forums)
    Member
    Post count: 23064

    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)

    User (Old forums)
    Member
    Post count: 23064

    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)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.