davecouture

Me.Close() ArcMap crash

Discussion created by davecouture on Jun 22, 2012
Latest reply on Jun 23, 2012 by rlwatson
How can I close a Form without ArcMap crashing?

Example:

       
Imports ESRI.ArcGIS.esriSystem
Imports ESRI.ArcGIS.Geometry
Imports ESRI.ArcGIS.Geodatabase
Imports ESRI.ArcGIS.Carto
Imports System.IO
Imports Microsoft.VisualBasic
Imports System
Imports System.Windows.Forms


Public Class FindAddressForm
    Inherits System.Windows.Forms.Form

    Public Sub New()
        MyBase.New()

        InitializeComponent()
        ' Populate the street name ComboBox from text file
        Dim streetList As String
        streetList = "\\csjs186\CPCommon\ArcMap Add-ins\StreetNameList2.txt"

        If File.Exists(streetList) Then
            Dim r As IO.StreamReader
            r = New IO.StreamReader(streetList)
            While (r.Peek() > -1)
                ComboBox1.Items.Add(r.ReadLine.Trim)
            End While
            r.Close()
        Else
            MsgBox("Can't find " + streetList)
            Me.Close()
        End If

End Sub

Outcomes