Have you put a Try..Catch block in your New sub code to see what's going wrong?
Ken, I found out what was wrong with my program and finally got my form to open up.First, let me say that my program doesn't just open one main form. Once the main form is opened up, the user can press a button to open up a second form. I did what you suggested by adding a Try...Catch block and the error that was generated said something about missing resources for my second form.So I compared my first form with the second form and found only one difference. On the first form I had added an icon for the Icon property. This created a *.resx file for the first form. The second form had not been assigned an icon and so did not have a *.resx file.To resolve my problem, I first just commented out any references to the second form. That enabled me to open my first form. So then to be able to open my second form, I uncommented the code and added an icon for the Icon property. At this point, I was able to open the second form by pressing a button on the first form.Here is my code I used to open the first form from the button add-in class module: Protected Overrides Sub OnClick()
Try
If Not myFrmMain Is Nothing Then
If myFrmMain.IsHandleCreated = False Then
myFrmMain = New frmMain
myFrmMain.Show()
End If
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
And here is the code that used to open the second form from a button click event on the first form: 'Class-level variable:
Dim myFrmDesc As frmDesc
Private Sub btnLayerDesc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLayerDesc.Click
mListBox = Me.lstLayers
Call OpenFrmDesc(True)
End Sub
Public Sub OpenFrmDesc(ByVal ShowYN As Boolean)
Try
myFrmDesc = New frmDesc
If myFrmDesc.IsHandleCreated = False Then
myFrmDesc.Show()
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub