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
OK, I've pinpointed the issue to be the line within the dragdrop event of the destination grid. I was displaying a very basic dialoge form (form.ShowDialog). It seemed that, on the client pc (not my dev machine as that works!) that the call to ShowDialog() was causing the event not to fire. I was able to test this by commenting this out or, alternatively, placing an exit sub before the call to ShowDialog(). I tried to test a value of a check box to decide if the exit sub would be called but it appears to be the case that, if there is a possibility that ShowDialog() would be called, the dragdrop event would not be fired. Looks like the .net framework could some how look forward to see the possibility of an error! You might be thinking the the dialoge being shown has some strange code in it that may cause this issue but this is a very basic form with a ultradatetimepicker, ultratextbox and a couple of ultra labels all with public modifiers to allow access to values after selecting the OK button (see below). I eventually fixed this by creating another basic form to be displayed via ShowDialog(). This new form did not use any Infragistics controls, just the default .net controls and it works a treat! Instantiate and show code (taken from dragDrop event): -
Dim dlgNewMovement As New MovementdlgNewMovement.lblFlockCode.Text = aRow.Cells("FlockCode").ValuedlgNewMovement.ShowDialog()If dlgNewMovement.DialogResult = DialogResult.Cancel Then Exit SubEnd If
Code of the broken form (see if you can spot the issue as I can't): -
Public Class dlgMovement Inherits frmBase#Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents UltraLabel1 As Infragistics.Win.Misc.UltraLabel Friend WithEvents btnCancel As System.Windows.Forms.Button Friend WithEvents btnOK As System.Windows.Forms.Button Friend WithEvents UltraLabel2 As Infragistics.Win.Misc.UltraLabel Protected Friend WithEvents txtDescription As System.Windows.Forms.TextBox Protected Friend WithEvents UCMovementDate As Infragistics.Win.UltraWinSchedule.UltraCalendarCombo Friend WithEvents UltraLabel3 As Infragistics.Win.Misc.UltraLabel Protected Friend WithEvents ULFlockCode As Infragistics.Win.Misc.UltraLabel <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Dim DateButton1 As Infragistics.Win.UltraWinSchedule.CalendarCombo.DateButton = New Infragistics.Win.UltraWinSchedule.CalendarCombo.DateButton Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(dlgMovement)) Me.UCMovementDate = New Infragistics.Win.UltraWinSchedule.UltraCalendarCombo Me.UltraLabel1 = New Infragistics.Win.Misc.UltraLabel Me.btnCancel = New System.Windows.Forms.Button Me.btnOK = New System.Windows.Forms.Button Me.txtDescription = New System.Windows.Forms.TextBox Me.UltraLabel2 = New Infragistics.Win.Misc.UltraLabel Me.UltraLabel3 = New Infragistics.Win.Misc.UltraLabel Me.ULFlockCode = New Infragistics.Win.Misc.UltraLabel CType(Me.UCMovementDate, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'UCMovementDate ' DateButton1.Caption = "Today" Me.UCMovementDate.DateButtons.Add(DateButton1) Me.UCMovementDate.Location = New System.Drawing.Point(132, 36) Me.UCMovementDate.Name = "UCMovementDate" Me.UCMovementDate.NonAutoSizeHeight = 23 Me.UCMovementDate.Size = New System.Drawing.Size(104, 21) Me.UCMovementDate.TabIndex = 0 ' 'UltraLabel1 ' Me.UltraLabel1.Location = New System.Drawing.Point(8, 36) Me.UltraLabel1.Name = "UltraLabel1" Me.UltraLabel1.Size = New System.Drawing.Size(124, 23) Me.UltraLabel1.TabIndex = 1 Me.UltraLabel1.Text = "Movement Date" ' 'btnCancel ' Me.btnCancel.Location = New System.Drawing.Point(296, 132) Me.btnCancel.Name = "btnCancel" Me.btnCancel.TabIndex = 2 Me.btnCancel.Text = "&Cancel" ' 'btnOK ' Me.btnOK.Location = New System.Drawing.Point(216, 132) Me.btnOK.Name = "btnOK" Me.btnOK.TabIndex = 3 Me.btnOK.Text = "&OK" ' 'txtDescription ' Me.txtDescription.Location = New System.Drawing.Point(132, 64) Me.txtDescription.Multiline = True Me.txtDescription.Name = "txtDescription" Me.txtDescription.Size = New System.Drawing.Size(240, 64) Me.txtDescription.TabIndex = 4 Me.txtDescription.Text = "" ' 'UltraLabel2 ' Me.UltraLabel2.Location = New System.Drawing.Point(8, 64) Me.UltraLabel2.Name = "UltraLabel2" Me.UltraLabel2.Size = New System.Drawing.Size(124, 23) Me.UltraLabel2.TabIndex = 5 Me.UltraLabel2.Text = "Movement Description" ' 'UltraLabel3 ' Me.UltraLabel3.Location = New System.Drawing.Point(8, 8) Me.UltraLabel3.Name = "UltraLabel3" Me.UltraLabel3.Size = New System.Drawing.Size(124, 23) Me.UltraLabel3.TabIndex = 6 Me.UltraLabel3.Text = "To Flock Code" ' 'ULFlockCode ' Me.ULFlockCode.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.ULFlockCode.Location = New System.Drawing.Point(136, 8) Me.ULFlockCode.Name = "ULFlockCode" Me.ULFlockCode.Size = New System.Drawing.Size(124, 23) Me.ULFlockCode.TabIndex = 7 ' 'dlgMovement ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(376, 157) Me.Controls.Add(Me.ULFlockCode) Me.Controls.Add(Me.UltraLabel3) Me.Controls.Add(Me.UltraLabel2) Me.Controls.Add(Me.txtDescription) Me.Controls.Add(Me.btnOK) Me.Controls.Add(Me.btnCancel) Me.Controls.Add(Me.UltraLabel1) Me.Controls.Add(Me.UCMovementDate) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.Name = "dlgMovement" Me.ShowInTaskbar = False Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Movement Details" CType(Me.UCMovementDate, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub#End Region Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click Me.DialogResult = DialogResult.Cancel End Sub Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click Me.DialogResult = DialogResult.OK End SubEnd Class
I've tested this in v4.3 and v7.2 of the IG controls still no luck
The destination grid has 2 bands could this be an issue?
This is unrelated to VMWare as this also occurs on seperate client installations