Have you put a Try..Catch block in your New sub code to see what's going wrong?
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
'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
Public Class frmMain Public Function InitializeForm() As Boolean InitializeForm = False If My.ArcMap.Document.ActiveView IsNot My.ArcMap.Document.PageLayout Then InitializeForm = True End If If Me.Visible = False Then InitializeForm = True End If End Function 'more code... End Class
Dim myFrmMain As New frmMain If myFrmMain.InitializeForm = True Then myFrmMain.ShowDialog()
Public Class CompatibilityForm Private pEnumLayers As ESRI.ArcGIS.Carto.IEnumLayer Private pLayer As ESRI.ArcGIS.Carto.ILayer2 Public Function InitializeForm() As Boolean Try pEnumLayers = My.ArcMap.Document.FocusMap.Layers pLayer = pEnumLayers.Next Do Until pLayer Is Nothing If pLayer.Valid Then If TypeOf pLayer Is ESRI.ArcGIS.Carto.IFeatureLayer Then cboLayer.Items.Add(pLayer.Name) End If pLayer = pEnumLayers.Next Loop Return True Catch ex As Exception System.Windows.Forms.MessageBox.Show(ex.ToString, "Compatibility Form: InitializeForm") Return False End Try End Function ' more form code End Class
Dim NewCompForm As New CompatibilityForm If NewCompForm.InitializeForm Then NewCompForm.ShowDialog()
I'm developing add-ins on a Win 7 64 bit computer and don't have any problems with opening forms. Do you have any code in the form initialization routine?
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.