Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1833
DragDrop event does not fire when deployed!
posted

I've an MDI application that loads forms from a .dll. I have 2 forms, both using the ultra wingrid. I've followed the examples provided on the Infragistics website and have it working fine on my development machine (XP Corp). However, when deployed the dragdrop event is not fired in either XP or Vista (haven't tested other OS).

I use VMWare for testing and I've debugged the client deployment via VMWare remote debugging and can confirm that the dragover event is called.
I have no other mouse events on either form to interfere.I've placed break points on all other grid events to see if they are having an effect but this does not appear to be the case.

NOTE: I have set the allow drop property on the grid

Code is as follows: -


******* Form 1 *********

    Private Sub UGResults_SelectionDrag(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles UGResults.SelectionDrag
      UGResults.DoDragDrop(UGResults.Selected.Rows, DragDropEffects.Move)
    End Sub
 
******* Form 2 *********

    Private Sub UGContactsToFlocks_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles UGContactsToFlocks.DragOver
      e.Effect = DragDropEffects.Move
    End Sub

Private Sub UGContactsToFlocks_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles UGContactsToFlocks.DragDrop
      Try

        Dim SelRows As SelectedRowsCollection
        SelRows = e.Data.GetData(GetType(SelectedRowsCollection))

        Dim aUIElement As Infragistics.Win.UIElement
        aUIElement _
        = UGContactsToFlocks.DisplayLayout.UIElement.ElementFromPoint(UGContactsToFlocks.PointToClient(New Point(e.X, e.Y)))

        If aUIElement Is Nothing Then Exit Sub
        Dim aBand As UltraGridBand

        'Hopefuly it'll be a row
        Dim aRow As UltraGridRow
        aRow = aUIElement.GetContext(GetType(UltraGridRow))
        If Not aRow Is Nothing Then
          aBand = UGContactsToFlocks.DisplayLayout.Bands(aRow.Band.Index)
        End If
        If aBand Is Nothing Then

          'Could be a column
          Dim aColumn As UltraGridColumn
          aColumn = aUIElement.GetContext(GetType(UltraGridColumn))
          If Not aColumn Is Nothing Then
            aBand = UGContactsToFlocks.DisplayLayout.Bands(aColumn.Band.Index)
          End If
        End If
        If aRow Is Nothing Then
          MsgBox("Please ensure that you drop your selection on a flock row. Drag drop operation failed", MsgBoxStyle.Exclamation)
          Exit Sub
        End If
        If aRow.Band Is Me.UGContactsToFlocks.DisplayLayout.Bands(0) Then
          MsgBox("Please ensure that you drop your selection on a flock row. Drag drop operation failed", MsgBoxStyle.Exclamation)
        Else
          'Dim msgResult As MsgBoxResult = MsgBox("Are you sure that you want to move the selected sample(s) to this flock (" & IIf(aRow.Cells("FlockCode").Value = "", "No flock code", aRow.Cells("FlockCode").Value) & ")", MsgBoxStyle.YesNo Or MsgBoxStyle.Question)
          'If msgResult = MsgBoxResult.Yes Then
          '  MsgBox("About to create movement record for " & SelRows.Count & " row(s)")
          'End If

          'Display dialoge to get movement date & description
          Dim dlgNewMovement As New dlgMovement
          dlgNewMovement.ULFlockCode.Text = aRow.Cells("FlockCode").Value
          Dim dlgResult As DialogResult = dlgNewMovement.ShowDialog()
          If dlgResult = DialogResult.Cancel Then
            Exit Sub
          End If

          'Now create the movement records and update database
          Dim dsNewMevements As New dsMovements
          For Each row As UltraGridRow In SelRows
            Dim newRow As DataRow = dsNewMevements.Tables(0).NewRow
            newRow.Item("SampleID") = row.Cells("ID").Value
            newRow.Item("FromFlockID") = Kernel.getCurrentFlockIDBy(row.Cells("ID").Value)
            newRow.Item("ToFlockID") = aRow.Cells("FlockID").Value
            newRow.Item("MovementDate") = dlgNewMovement.UCMovementDate.Value
            newRow.Item("MovementDescription") = dlgNewMovement.txtDescription.Text
            dsNewMevements.Tables(0).Rows.Add(newRow)
          Next
          Kernel.updateMovements(dsNewMevements)
        End If
      Catch ex As Exception
        MsgBox("Exception thrown during drag & drop operation. Operation failed. " & ex.Message, MsgBoxStyle.Exclamation)
      End Try
    End Sub

Parents Reply Children
No Data