I have a form with a grid on it. I have handled the row click event (I am using devexpress winforms addins). I take the employee id from the first form, open the second form and set a value for one of the lookup combos. The first time i do this it works perfectly. If i then close that second form and double click on a different row in that grid, the application freezes on frmglobals.frm_metrics.show. It doesnt even get into the second forms load event. if i debug and F11 it, it just freezes when i f11 that line.
No idea what is causing the problem
Am i closing the second form incorrectly or something?
No idea what is causing the problem
VB.NET:
Private Sub smetsumGV_DoubleClick(sender As Object, e As EventArgs) Handles smetsumGV.DoubleClick
'Handle row double click
Try
'Get hit point of grid double click
Dim view As GridView = CType(sender, GridView)
Dim pt As Point = view.GridControl.PointToClient(Control.MousePosition)
Dim info As GridHitInfo = view.CalcHitInfo(pt)
'Is point in row
If info.InRow OrElse info.InRowCell Then
Dim emplid As String = smetsumGV.GetRowCellValue(smetsumGV.FocusedRowHandle, GridColumn17)
''See if form is already open, but just hidden
If frmGlobals.frm_metrics Is Nothing Then
'if form is not already open, create new instance of form
frmGlobals.frm_metrics = New frm_metrics
'Set start position of form to center screen (since MDI Child, sets it to center screen of frm_menu)
frmGlobals.frm_metrics.StartPosition = FormStartPosition.CenterScreen
'Set parent container to menu form.
frmGlobals.frm_metrics.MdiParent = frm_menu
'Show form
frmGlobals.frm_metrics.Show()
End If
'Filter by manager.
frmGlobals.frm_metrics.mgrLUE.EditValue = emplid
'Bring form to front
frmGlobals.frm_metrics.BringToFront()
End If
Catch ex As Exception
'Provide Error message to user.
MsgBox("Error: " + ex.Message, MsgBoxStyle.Exclamation, "Error")
'Log Error
Dim errta As New EMS_DSTableAdapters.StoredProcedures
errta.insertError(Date.Now, ex.ToString, "frm_metrics_sectsum: Row Double Click", My.Settings.user)
End Try
End Sub
Am i closing the second form incorrectly or something?
VB.NET:
Private Sub frm_metricsnew_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
'Handle form close by disposing controls and form
For Each c In Me.Controls
c.dispose()
Next
Me.Dispose(True)
End Sub