It has been my practice for many years in VB.4,5,6 to show errors by opening an "error form" and printing to it the class/module, procedure/subprocedure and the error message on the form.
I have migrated almost all of my VB.6 programs to VB.Net and have encountered a problem with this process.
If I call one of my overloaded ShowIt procedures when there has been no form constructed, the form shows up in the correct location, with the correct size and the first and all subsequent errors printed properly.
But, when you pass the cursor over the form it turns to an hourglass. The form can not be dragged, minimized or closed.
If you set up the form before an error, then all subsequent calls to ShowIt work correctly and the form behave normally.
What am I missing
Thanks
RCarey
Here is my error class.
Public Class clsError
Private dG As System.drawing.Graphics
Private dFt As System.Drawing.Font
Private dBr As SolidBrush
Private dFm As StringFormat
Private dX, dY As Integer
Private lineCount, maxLines As Double
Public Sub SetUpForm() '1/14/04
Dim dbgString As String
Try
frmError = New Form3
With frmError
.Left = 0
.Text = "Errors"
.Top = 384
.Width = 1000
End With
frmError.Show()
Catch ex As Exception
dbgString = ex.Message.ToString
Stop
End Try
Try
dG = frmError.CreateGraphics
dFt = New System.Drawing.Font("Ariel", 7, FontStyle.Regular)
dBr = New SolidBrush(Color.Black)
dFm = New StringFormat
dFm.FormatFlags = StringFormatFlags.MeasureTrailingSpaces
Catch ex As Exception
dbgString = ex.Message.ToString
Stop
End Try
Try
maxLines = Math.Round(frmError.ClientSize.Height / dFt.GetHeight)
Catch ex As Exception
dbgString = ex.Message.ToString
Stop
End Try
End Sub
Private Sub ClearForm() '1/14/04
Dim dbgString As String
Try
dG.Clear(frmError.BackColor)
lineCount = 0
dY = 0
dX = 0
Catch ex As Exception
dbgString = ex.Message.ToString
Stop
End Try
End Sub
Public Overloads Sub Showit(ByVal inString As String) '1/14/04
Dim dbgString As String
Try
If frmError Is Nothing Then 'set up the form
SetUpForm()
End If
Catch ex As Exception
dbgString = ex.Message.ToString
Stop
End Try
Try
If lineCount >= maxLines Then
ClearForm()
End If
Catch ex As Exception
dbgString = ex.Message.ToString
Stop
End Try
Try
dX = 0
dG.DrawString(inString, dFt, dBr, dX, dY)
lineCount += 1
dY += dFt.Height
Catch ex As Exception
dbgString = ex.Message.ToString
Stop
End Try
End Sub
Public Overloads Sub Showit(ByVal inClass As String, ByVal inProcedure As String, ByVal message As String)
Dim dbgString As String
Try
If frmError Is Nothing Then 'set up the form
SetUpForm()
End If
Catch ex As Exception
dbgString = ex.Message.ToString
Stop
End Try
Try
If lineCount > maxLines Then
ClearForm()
End If
Catch ex As Exception
dbgString = ex.Message.ToString
Stop
End Try
Try
dX = 0
dG.DrawString(inClass, dFt, dBr, dX, dY)
dX = 50
dG.DrawString(inProcedure, dFt, dBr, dX, dY)
dX = 200
dG.DrawString(message, dFt, dBr, dX, dY)
lineCount += 1
dY += dFt.Height
Catch ex As Exception
dbgString = ex.Message.ToString
Stop
End Try
End Sub
End Class

Locked Up Form