I am trying to create a basic form using ArcObjects (VB.NET) to view in ArcMap 10.0. I have created the form using the designer but can't view it in ArcMap. I have created a button that will call the form and show it using
form.show() method but seems it does nothing when I click it.
How can I show GUI forms in ArcMap? I thought by creating a separate button to call the form will work?
Public Class ArcGISForm Public Sub New(ByVal hook As Object) ' This call is required by the Windows Form Designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. Me.Hook = hook End Sub Private m_hook As Object Public Property Hook() As Object Get Return m_hook End Get Set(ByVal value As Object) m_hook = value End Set End Property ''' <summary> '''creating and disposing the user interface class for the dockable window. ''' </summary> Public Class AddinImpl Inherits ESRI.ArcGIS.Desktop.AddIns.DockableWindow Private m_windowUI As ArcGISForm Protected Overrides Function OnCreateChild() As System.IntPtr m_windowUI = New ArcGISForm(Me.Hook) Return m_windowUI.Handle End Function Protected Overrides Sub Dispose(ByVal Param As Boolean) If m_windowUI IsNot Nothing Then m_windowUI.Dispose(Param) End If MyBase.Dispose(Param) End Sub End Class Private Sub ArcGISForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim frm2 As New ArcMapAddin2.ArcGISForm(Me.Hook) frm2.Hide() End Sub End Class
Here is how I am trying to call the form, from a button.
Public Class showform Inherits ESRI.ArcGIS.Desktop.AddIns.Button Public Sub New() End Sub Protected Overrides Sub OnClick() Dim frm As New ArcMapAddin2.ArcGISForm(Me.Hook) frm.Show() End Sub Protected Overrides Sub OnUpdate() End Sub End Class
Any ideas how I can open the form from the button? Or should I follow a different method?
I have tried the following and still doesn't work:
Dim oForm As ArcGISForm oForm = New ArcGISForm(Me.Hook) oForm.ShowDialog() oForm = Nothing
All it does is close ArcMap down. When I click the button.